changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
child 18 | be944660c56a |
15:3d4e9c994f10 | 16:a86126ab1dd4 |
---|---|
80 /******/ // __webpack_public_path__ |
80 /******/ // __webpack_public_path__ |
81 /******/ __webpack_require__.p = ""; |
81 /******/ __webpack_require__.p = ""; |
82 /******/ |
82 /******/ |
83 /******/ |
83 /******/ |
84 /******/ // Load entry module and return exports |
84 /******/ // Load entry module and return exports |
85 /******/ return __webpack_require__(__webpack_require__.s = 358); |
85 /******/ return __webpack_require__(__webpack_require__.s = 438); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 0: |
90 /***/ 0: |
100 (function() { module.exports = this["wp"]["i18n"]; }()); |
100 (function() { module.exports = this["wp"]["i18n"]; }()); |
101 |
101 |
102 /***/ }), |
102 /***/ }), |
103 |
103 |
104 /***/ 10: |
104 /***/ 10: |
105 /***/ (function(module, exports) { |
|
106 |
|
107 (function() { module.exports = this["wp"]["blocks"]; }()); |
|
108 |
|
109 /***/ }), |
|
110 |
|
111 /***/ 100: |
|
112 /***/ (function(module, exports) { |
|
113 |
|
114 (function() { module.exports = this["wp"]["notices"]; }()); |
|
115 |
|
116 /***/ }), |
|
117 |
|
118 /***/ 103: |
|
119 /***/ (function(module, exports) { |
|
120 |
|
121 (function() { module.exports = this["wp"]["autop"]; }()); |
|
122 |
|
123 /***/ }), |
|
124 |
|
125 /***/ 11: |
|
126 /***/ (function(module, exports, __webpack_require__) { |
|
127 |
|
128 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
129 Copyright (c) 2017 Jed Watson. |
|
130 Licensed under the MIT License (MIT), see |
|
131 http://jedwatson.github.io/classnames |
|
132 */ |
|
133 /* global define */ |
|
134 |
|
135 (function () { |
|
136 'use strict'; |
|
137 |
|
138 var hasOwn = {}.hasOwnProperty; |
|
139 |
|
140 function classNames () { |
|
141 var classes = []; |
|
142 |
|
143 for (var i = 0; i < arguments.length; i++) { |
|
144 var arg = arguments[i]; |
|
145 if (!arg) continue; |
|
146 |
|
147 var argType = typeof arg; |
|
148 |
|
149 if (argType === 'string' || argType === 'number') { |
|
150 classes.push(arg); |
|
151 } else if (Array.isArray(arg) && arg.length) { |
|
152 var inner = classNames.apply(null, arg); |
|
153 if (inner) { |
|
154 classes.push(inner); |
|
155 } |
|
156 } else if (argType === 'object') { |
|
157 for (var key in arg) { |
|
158 if (hasOwn.call(arg, key) && arg[key]) { |
|
159 classes.push(key); |
|
160 } |
|
161 } |
|
162 } |
|
163 } |
|
164 |
|
165 return classes.join(' '); |
|
166 } |
|
167 |
|
168 if ( true && module.exports) { |
|
169 classNames.default = classNames; |
|
170 module.exports = classNames; |
|
171 } else if (true) { |
|
172 // register as 'classnames', consistent with npm package name |
|
173 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
174 return classNames; |
|
175 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
176 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
177 } else {} |
|
178 }()); |
|
179 |
|
180 |
|
181 /***/ }), |
|
182 |
|
183 /***/ 110: |
|
184 /***/ (function(module, exports, __webpack_require__) { |
|
185 |
|
186 "use strict"; |
|
187 |
|
188 |
|
189 function flattenIntoMap( map, effects ) { |
|
190 var i; |
|
191 if ( Array.isArray( effects ) ) { |
|
192 for ( i = 0; i < effects.length; i++ ) { |
|
193 flattenIntoMap( map, effects[ i ] ); |
|
194 } |
|
195 } else { |
|
196 for ( i in effects ) { |
|
197 map[ i ] = ( map[ i ] || [] ).concat( effects[ i ] ); |
|
198 } |
|
199 } |
|
200 } |
|
201 |
|
202 function refx( effects ) { |
|
203 var map = {}, |
|
204 middleware; |
|
205 |
|
206 flattenIntoMap( map, effects ); |
|
207 |
|
208 middleware = function( store ) { |
|
209 return function( next ) { |
|
210 return function( action ) { |
|
211 var handlers = map[ action.type ], |
|
212 result = next( action ), |
|
213 i, handlerAction; |
|
214 |
|
215 if ( handlers ) { |
|
216 for ( i = 0; i < handlers.length; i++ ) { |
|
217 handlerAction = handlers[ i ]( action, store ); |
|
218 if ( handlerAction ) { |
|
219 store.dispatch( handlerAction ); |
|
220 } |
|
221 } |
|
222 } |
|
223 |
|
224 return result; |
|
225 }; |
|
226 }; |
|
227 }; |
|
228 |
|
229 middleware.effects = map; |
|
230 |
|
231 return middleware; |
|
232 } |
|
233 |
|
234 module.exports = refx; |
|
235 |
|
236 |
|
237 /***/ }), |
|
238 |
|
239 /***/ 12: |
|
105 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
240 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
106 |
241 |
107 "use strict"; |
242 "use strict"; |
108 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); |
243 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); |
109 function _classCallCheck(instance, Constructor) { |
244 function _assertThisInitialized(self) { |
110 if (!(instance instanceof Constructor)) { |
245 if (self === void 0) { |
111 throw new TypeError("Cannot call a class as a function"); |
246 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
112 } |
247 } |
248 |
|
249 return self; |
|
113 } |
250 } |
114 |
251 |
115 /***/ }), |
252 /***/ }), |
116 |
253 |
117 /***/ 109: |
254 /***/ 13: |
118 /***/ (function(module, exports) { |
255 /***/ (function(module, exports) { |
119 |
256 |
120 if (typeof Object.create === 'function') { |
257 (function() { module.exports = this["React"]; }()); |
121 // implementation from standard node.js 'util' module |
258 |
122 module.exports = function inherits(ctor, superCtor) { |
259 /***/ }), |
123 ctor.super_ = superCtor |
260 |
124 ctor.prototype = Object.create(superCtor.prototype, { |
261 /***/ 134: |
125 constructor: { |
262 /***/ (function(module, exports, __webpack_require__) { |
126 value: ctor, |
263 |
127 enumerable: false, |
264 module.exports = __webpack_require__(421); |
128 writable: true, |
265 |
129 configurable: true |
266 |
130 } |
267 /***/ }), |
131 }); |
268 |
132 }; |
269 /***/ 137: |
133 } else { |
270 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
134 // old school shim for old browsers |
271 |
135 module.exports = function inherits(ctor, superCtor) { |
272 "use strict"; |
136 ctor.super_ = superCtor |
273 /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); |
137 var TempCtor = function () {} |
274 /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15); |
138 TempCtor.prototype = superCtor.prototype |
275 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); |
139 ctor.prototype = new TempCtor() |
276 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); |
140 ctor.prototype.constructor = ctor |
277 |
278 |
|
279 |
|
280 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
281 |
|
282 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
283 |
|
284 /** |
|
285 * WordPress dependencies |
|
286 */ |
|
287 // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly. |
|
288 |
|
289 /* eslint-disable jsdoc/valid-types */ |
|
290 |
|
291 /** @typedef {{icon: JSX.Element, size?: number} & import('react').ComponentPropsWithoutRef<'SVG'>} IconProps */ |
|
292 |
|
293 /* eslint-enable jsdoc/valid-types */ |
|
294 |
|
295 /** |
|
296 * Return an SVG icon. |
|
297 * |
|
298 * @param {IconProps} props icon is the SVG component to render |
|
299 * size is a number specifiying the icon size in pixels |
|
300 * Other props will be passed to wrapped SVG component |
|
301 * |
|
302 * @return {JSX.Element} Icon component |
|
303 */ |
|
304 |
|
305 function Icon(_ref) { |
|
306 var icon = _ref.icon, |
|
307 _ref$size = _ref.size, |
|
308 size = _ref$size === void 0 ? 24 : _ref$size, |
|
309 props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["icon", "size"]); |
|
310 |
|
311 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["cloneElement"])(icon, _objectSpread({ |
|
312 width: size, |
|
313 height: size |
|
314 }, props)); |
|
315 } |
|
316 |
|
317 /* harmony default export */ __webpack_exports__["a"] = (Icon); |
|
318 |
|
319 |
|
320 /***/ }), |
|
321 |
|
322 /***/ 138: |
|
323 /***/ (function(module, exports, __webpack_require__) { |
|
324 |
|
325 "use strict"; |
|
326 /** |
|
327 * Copyright (c) 2013-present, Facebook, Inc. |
|
328 * |
|
329 * This source code is licensed under the MIT license found in the |
|
330 * LICENSE file in the root directory of this source tree. |
|
331 */ |
|
332 |
|
333 |
|
334 |
|
335 var ReactPropTypesSecret = __webpack_require__(139); |
|
336 |
|
337 function emptyFunction() {} |
|
338 function emptyFunctionWithReset() {} |
|
339 emptyFunctionWithReset.resetWarningCache = emptyFunction; |
|
340 |
|
341 module.exports = function() { |
|
342 function shim(props, propName, componentName, location, propFullName, secret) { |
|
343 if (secret === ReactPropTypesSecret) { |
|
344 // It is still safe when called from React. |
|
345 return; |
|
346 } |
|
347 var err = new Error( |
|
348 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + |
|
349 'Use PropTypes.checkPropTypes() to call them. ' + |
|
350 'Read more at http://fb.me/use-check-prop-types' |
|
351 ); |
|
352 err.name = 'Invariant Violation'; |
|
353 throw err; |
|
354 }; |
|
355 shim.isRequired = shim; |
|
356 function getShim() { |
|
357 return shim; |
|
358 }; |
|
359 // Important! |
|
360 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. |
|
361 var ReactPropTypes = { |
|
362 array: shim, |
|
363 bool: shim, |
|
364 func: shim, |
|
365 number: shim, |
|
366 object: shim, |
|
367 string: shim, |
|
368 symbol: shim, |
|
369 |
|
370 any: shim, |
|
371 arrayOf: getShim, |
|
372 element: shim, |
|
373 elementType: shim, |
|
374 instanceOf: getShim, |
|
375 node: shim, |
|
376 objectOf: getShim, |
|
377 oneOf: getShim, |
|
378 oneOfType: getShim, |
|
379 shape: getShim, |
|
380 exact: getShim, |
|
381 |
|
382 checkPropTypes: emptyFunctionWithReset, |
|
383 resetWarningCache: emptyFunction |
|
384 }; |
|
385 |
|
386 ReactPropTypes.PropTypes = ReactPropTypes; |
|
387 |
|
388 return ReactPropTypes; |
|
389 }; |
|
390 |
|
391 |
|
392 /***/ }), |
|
393 |
|
394 /***/ 139: |
|
395 /***/ (function(module, exports, __webpack_require__) { |
|
396 |
|
397 "use strict"; |
|
398 /** |
|
399 * Copyright (c) 2013-present, Facebook, Inc. |
|
400 * |
|
401 * This source code is licensed under the MIT license found in the |
|
402 * LICENSE file in the root directory of this source tree. |
|
403 */ |
|
404 |
|
405 |
|
406 |
|
407 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
|
408 |
|
409 module.exports = ReactPropTypesSecret; |
|
410 |
|
411 |
|
412 /***/ }), |
|
413 |
|
414 /***/ 14: |
|
415 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
416 |
|
417 "use strict"; |
|
418 |
|
419 // EXPORTS |
|
420 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); |
|
421 |
|
422 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
423 var arrayWithHoles = __webpack_require__(38); |
|
424 |
|
425 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
426 function _iterableToArrayLimit(arr, i) { |
|
427 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
|
428 var _arr = []; |
|
429 var _n = true; |
|
430 var _d = false; |
|
431 var _e = undefined; |
|
432 |
|
433 try { |
|
434 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
435 _arr.push(_s.value); |
|
436 |
|
437 if (i && _arr.length === i) break; |
|
438 } |
|
439 } catch (err) { |
|
440 _d = true; |
|
441 _e = err; |
|
442 } finally { |
|
443 try { |
|
444 if (!_n && _i["return"] != null) _i["return"](); |
|
445 } finally { |
|
446 if (_d) throw _e; |
|
447 } |
|
141 } |
448 } |
142 } |
449 |
143 |
450 return _arr; |
451 } |
|
452 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
453 var unsupportedIterableToArray = __webpack_require__(29); |
|
454 |
|
455 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
456 var nonIterableRest = __webpack_require__(39); |
|
457 |
|
458 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 function _slicedToArray(arr, i) { |
|
464 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
465 } |
|
144 |
466 |
145 /***/ }), |
467 /***/ }), |
146 |
468 |
147 /***/ 11: |
469 /***/ 147: |
470 /***/ (function(module, exports) { |
|
471 |
|
472 (function() { module.exports = this["wp"]["wordcount"]; }()); |
|
473 |
|
474 /***/ }), |
|
475 |
|
476 /***/ 15: |
|
148 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
477 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
149 |
478 |
150 "use strict"; |
479 "use strict"; |
151 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); |
480 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
152 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); |
481 /* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41); |
153 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); |
482 |
154 |
483 function _objectWithoutProperties(source, excluded) { |
155 |
484 if (source == null) return {}; |
156 function _possibleConstructorReturn(self, call) { |
485 var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); |
157 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { |
486 var key, i; |
158 return call; |
487 |
488 if (Object.getOwnPropertySymbols) { |
|
489 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
490 |
|
491 for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
492 key = sourceSymbolKeys[i]; |
|
493 if (excluded.indexOf(key) >= 0) continue; |
|
494 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
495 target[key] = source[key]; |
|
496 } |
|
159 } |
497 } |
160 |
498 |
161 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); |
499 return target; |
162 } |
500 } |
163 |
501 |
164 /***/ }), |
502 /***/ }), |
165 |
503 |
166 /***/ 111: |
504 /***/ 152: |
505 /***/ (function(module, exports) { |
|
506 |
|
507 (function() { module.exports = this["wp"]["mediaUtils"]; }()); |
|
508 |
|
509 /***/ }), |
|
510 |
|
511 /***/ 154: |
|
512 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
513 |
|
514 "use strict"; |
|
515 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
516 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
517 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
|
518 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
519 |
|
520 |
|
521 /** |
|
522 * WordPress dependencies |
|
523 */ |
|
524 |
|
525 var close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
526 xmlns: "http://www.w3.org/2000/svg", |
|
527 viewBox: "0 0 24 24" |
|
528 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
529 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" |
|
530 })); |
|
531 /* harmony default export */ __webpack_exports__["a"] = (close); |
|
532 |
|
533 |
|
534 /***/ }), |
|
535 |
|
536 /***/ 155: |
|
537 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
538 |
|
539 "use strict"; |
|
540 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
541 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
542 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
|
543 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
544 |
|
545 |
|
546 /** |
|
547 * WordPress dependencies |
|
548 */ |
|
549 |
|
550 var check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
551 xmlns: "http://www.w3.org/2000/svg", |
|
552 viewBox: "0 0 24 24" |
|
553 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
554 d: "M9 18.6L3.5 13l1-1L9 16.4l9.5-9.9 1 1z" |
|
555 })); |
|
556 /* harmony default export */ __webpack_exports__["a"] = (check); |
|
557 |
|
558 |
|
559 /***/ }), |
|
560 |
|
561 /***/ 16: |
|
562 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
563 |
|
564 "use strict"; |
|
565 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); |
|
566 function _getPrototypeOf(o) { |
|
567 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { |
|
568 return o.__proto__ || Object.getPrototypeOf(o); |
|
569 }; |
|
570 return _getPrototypeOf(o); |
|
571 } |
|
572 |
|
573 /***/ }), |
|
574 |
|
575 /***/ 173: |
|
167 /***/ (function(module, exports, __webpack_require__) { |
576 /***/ (function(module, exports, __webpack_require__) { |
168 |
577 |
169 "use strict"; |
578 "use strict"; |
170 |
579 |
171 var __extends = (this && this.__extends) || (function () { |
580 var __extends = (this && this.__extends) || (function () { |
194 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) |
603 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) |
195 t[p[i]] = s[p[i]]; |
604 t[p[i]] = s[p[i]]; |
196 return t; |
605 return t; |
197 }; |
606 }; |
198 exports.__esModule = true; |
607 exports.__esModule = true; |
199 var React = __webpack_require__(27); |
608 var React = __webpack_require__(13); |
200 var PropTypes = __webpack_require__(31); |
609 var PropTypes = __webpack_require__(28); |
201 var autosize = __webpack_require__(112); |
610 var autosize = __webpack_require__(174); |
202 var _getLineHeight = __webpack_require__(113); |
611 var _getLineHeight = __webpack_require__(175); |
203 var getLineHeight = _getLineHeight; |
612 var getLineHeight = _getLineHeight; |
204 var UPDATE = 'autosize:update'; |
613 var UPDATE = 'autosize:update'; |
205 var DESTROY = 'autosize:destroy'; |
614 var DESTROY = 'autosize:destroy'; |
206 var RESIZED = 'autosize:resized'; |
615 var RESIZED = 'autosize:resized'; |
207 /** |
616 /** |
290 exports["default"] = TextareaAutosize; |
699 exports["default"] = TextareaAutosize; |
291 |
700 |
292 |
701 |
293 /***/ }), |
702 /***/ }), |
294 |
703 |
295 /***/ 112: |
704 /***/ 174: |
296 /***/ (function(module, exports, __webpack_require__) { |
705 /***/ (function(module, exports, __webpack_require__) { |
297 |
706 |
298 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
707 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
299 autosize 4.0.2 |
708 autosize 4.0.2 |
300 license: MIT |
709 license: MIT |
579 module.exports = exports['default']; |
988 module.exports = exports['default']; |
580 }); |
989 }); |
581 |
990 |
582 /***/ }), |
991 /***/ }), |
583 |
992 |
584 /***/ 113: |
993 /***/ 175: |
585 /***/ (function(module, exports, __webpack_require__) { |
994 /***/ (function(module, exports, __webpack_require__) { |
586 |
995 |
587 // Load in dependencies |
996 // Load in dependencies |
588 var computedStyle = __webpack_require__(114); |
997 var computedStyle = __webpack_require__(176); |
589 |
998 |
590 /** |
999 /** |
591 * Calculate the `line-height` of a given node |
1000 * Calculate the `line-height` of a given node |
592 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. |
1001 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. |
593 * @returns {Number} `line-height` of the element in pixels |
1002 * @returns {Number} `line-height` of the element in pixels |
683 module.exports = lineHeight; |
1092 module.exports = lineHeight; |
684 |
1093 |
685 |
1094 |
686 /***/ }), |
1095 /***/ }), |
687 |
1096 |
688 /***/ 114: |
1097 /***/ 176: |
689 /***/ (function(module, exports) { |
1098 /***/ (function(module, exports) { |
690 |
1099 |
691 // This code has been refactored for 140 bytes |
1100 // This code has been refactored for 140 bytes |
692 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js |
1101 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js |
693 var computedStyle = function (el, prop, getComputedStyle) { |
1102 var computedStyle = function (el, prop, getComputedStyle) { |
717 module.exports = computedStyle; |
1126 module.exports = computedStyle; |
718 |
1127 |
719 |
1128 |
720 /***/ }), |
1129 /***/ }), |
721 |
1130 |
722 /***/ 117: |
1131 /***/ 177: |
723 /***/ (function(module, exports, __webpack_require__) { |
1132 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
724 |
1133 |
725 /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ |
1134 "use strict"; |
726 ;(function(root) { |
1135 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
727 |
1136 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
728 /** Detect free variables */ |
1137 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
729 var freeExports = true && exports && |
1138 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
730 !exports.nodeType && exports; |
1139 |
731 var freeModule = true && module && |
1140 |
732 !module.nodeType && module; |
1141 /** |
733 var freeGlobal = typeof global == 'object' && global; |
1142 * WordPress dependencies |
734 if ( |
1143 */ |
735 freeGlobal.global === freeGlobal || |
1144 |
736 freeGlobal.window === freeGlobal || |
1145 var closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
737 freeGlobal.self === freeGlobal |
1146 xmlns: "http://www.w3.org/2000/svg", |
738 ) { |
1147 viewBox: "0 0 24 24" |
739 root = freeGlobal; |
1148 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
740 } |
1149 d: "M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z" |
741 |
1150 })); |
742 /** |
1151 /* harmony default export */ __webpack_exports__["a"] = (closeSmall); |
743 * The `punycode` object. |
1152 |
744 * @name punycode |
|
745 * @type Object |
|
746 */ |
|
747 var punycode, |
|
748 |
|
749 /** Highest positive signed 32-bit float value */ |
|
750 maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 |
|
751 |
|
752 /** Bootstring parameters */ |
|
753 base = 36, |
|
754 tMin = 1, |
|
755 tMax = 26, |
|
756 skew = 38, |
|
757 damp = 700, |
|
758 initialBias = 72, |
|
759 initialN = 128, // 0x80 |
|
760 delimiter = '-', // '\x2D' |
|
761 |
|
762 /** Regular expressions */ |
|
763 regexPunycode = /^xn--/, |
|
764 regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars |
|
765 regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators |
|
766 |
|
767 /** Error messages */ |
|
768 errors = { |
|
769 'overflow': 'Overflow: input needs wider integers to process', |
|
770 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', |
|
771 'invalid-input': 'Invalid input' |
|
772 }, |
|
773 |
|
774 /** Convenience shortcuts */ |
|
775 baseMinusTMin = base - tMin, |
|
776 floor = Math.floor, |
|
777 stringFromCharCode = String.fromCharCode, |
|
778 |
|
779 /** Temporary variable */ |
|
780 key; |
|
781 |
|
782 /*--------------------------------------------------------------------------*/ |
|
783 |
|
784 /** |
|
785 * A generic error utility function. |
|
786 * @private |
|
787 * @param {String} type The error type. |
|
788 * @returns {Error} Throws a `RangeError` with the applicable error message. |
|
789 */ |
|
790 function error(type) { |
|
791 throw new RangeError(errors[type]); |
|
792 } |
|
793 |
|
794 /** |
|
795 * A generic `Array#map` utility function. |
|
796 * @private |
|
797 * @param {Array} array The array to iterate over. |
|
798 * @param {Function} callback The function that gets called for every array |
|
799 * item. |
|
800 * @returns {Array} A new array of values returned by the callback function. |
|
801 */ |
|
802 function map(array, fn) { |
|
803 var length = array.length; |
|
804 var result = []; |
|
805 while (length--) { |
|
806 result[length] = fn(array[length]); |
|
807 } |
|
808 return result; |
|
809 } |
|
810 |
|
811 /** |
|
812 * A simple `Array#map`-like wrapper to work with domain name strings or email |
|
813 * addresses. |
|
814 * @private |
|
815 * @param {String} domain The domain name or email address. |
|
816 * @param {Function} callback The function that gets called for every |
|
817 * character. |
|
818 * @returns {Array} A new string of characters returned by the callback |
|
819 * function. |
|
820 */ |
|
821 function mapDomain(string, fn) { |
|
822 var parts = string.split('@'); |
|
823 var result = ''; |
|
824 if (parts.length > 1) { |
|
825 // In email addresses, only the domain name should be punycoded. Leave |
|
826 // the local part (i.e. everything up to `@`) intact. |
|
827 result = parts[0] + '@'; |
|
828 string = parts[1]; |
|
829 } |
|
830 // Avoid `split(regex)` for IE8 compatibility. See #17. |
|
831 string = string.replace(regexSeparators, '\x2E'); |
|
832 var labels = string.split('.'); |
|
833 var encoded = map(labels, fn).join('.'); |
|
834 return result + encoded; |
|
835 } |
|
836 |
|
837 /** |
|
838 * Creates an array containing the numeric code points of each Unicode |
|
839 * character in the string. While JavaScript uses UCS-2 internally, |
|
840 * this function will convert a pair of surrogate halves (each of which |
|
841 * UCS-2 exposes as separate characters) into a single code point, |
|
842 * matching UTF-16. |
|
843 * @see `punycode.ucs2.encode` |
|
844 * @see <https://mathiasbynens.be/notes/javascript-encoding> |
|
845 * @memberOf punycode.ucs2 |
|
846 * @name decode |
|
847 * @param {String} string The Unicode input string (UCS-2). |
|
848 * @returns {Array} The new array of code points. |
|
849 */ |
|
850 function ucs2decode(string) { |
|
851 var output = [], |
|
852 counter = 0, |
|
853 length = string.length, |
|
854 value, |
|
855 extra; |
|
856 while (counter < length) { |
|
857 value = string.charCodeAt(counter++); |
|
858 if (value >= 0xD800 && value <= 0xDBFF && counter < length) { |
|
859 // high surrogate, and there is a next character |
|
860 extra = string.charCodeAt(counter++); |
|
861 if ((extra & 0xFC00) == 0xDC00) { // low surrogate |
|
862 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); |
|
863 } else { |
|
864 // unmatched surrogate; only append this code unit, in case the next |
|
865 // code unit is the high surrogate of a surrogate pair |
|
866 output.push(value); |
|
867 counter--; |
|
868 } |
|
869 } else { |
|
870 output.push(value); |
|
871 } |
|
872 } |
|
873 return output; |
|
874 } |
|
875 |
|
876 /** |
|
877 * Creates a string based on an array of numeric code points. |
|
878 * @see `punycode.ucs2.decode` |
|
879 * @memberOf punycode.ucs2 |
|
880 * @name encode |
|
881 * @param {Array} codePoints The array of numeric code points. |
|
882 * @returns {String} The new Unicode string (UCS-2). |
|
883 */ |
|
884 function ucs2encode(array) { |
|
885 return map(array, function(value) { |
|
886 var output = ''; |
|
887 if (value > 0xFFFF) { |
|
888 value -= 0x10000; |
|
889 output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); |
|
890 value = 0xDC00 | value & 0x3FF; |
|
891 } |
|
892 output += stringFromCharCode(value); |
|
893 return output; |
|
894 }).join(''); |
|
895 } |
|
896 |
|
897 /** |
|
898 * Converts a basic code point into a digit/integer. |
|
899 * @see `digitToBasic()` |
|
900 * @private |
|
901 * @param {Number} codePoint The basic numeric code point value. |
|
902 * @returns {Number} The numeric value of a basic code point (for use in |
|
903 * representing integers) in the range `0` to `base - 1`, or `base` if |
|
904 * the code point does not represent a value. |
|
905 */ |
|
906 function basicToDigit(codePoint) { |
|
907 if (codePoint - 48 < 10) { |
|
908 return codePoint - 22; |
|
909 } |
|
910 if (codePoint - 65 < 26) { |
|
911 return codePoint - 65; |
|
912 } |
|
913 if (codePoint - 97 < 26) { |
|
914 return codePoint - 97; |
|
915 } |
|
916 return base; |
|
917 } |
|
918 |
|
919 /** |
|
920 * Converts a digit/integer into a basic code point. |
|
921 * @see `basicToDigit()` |
|
922 * @private |
|
923 * @param {Number} digit The numeric value of a basic code point. |
|
924 * @returns {Number} The basic code point whose value (when used for |
|
925 * representing integers) is `digit`, which needs to be in the range |
|
926 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is |
|
927 * used; else, the lowercase form is used. The behavior is undefined |
|
928 * if `flag` is non-zero and `digit` has no uppercase form. |
|
929 */ |
|
930 function digitToBasic(digit, flag) { |
|
931 // 0..25 map to ASCII a..z or A..Z |
|
932 // 26..35 map to ASCII 0..9 |
|
933 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); |
|
934 } |
|
935 |
|
936 /** |
|
937 * Bias adaptation function as per section 3.4 of RFC 3492. |
|
938 * https://tools.ietf.org/html/rfc3492#section-3.4 |
|
939 * @private |
|
940 */ |
|
941 function adapt(delta, numPoints, firstTime) { |
|
942 var k = 0; |
|
943 delta = firstTime ? floor(delta / damp) : delta >> 1; |
|
944 delta += floor(delta / numPoints); |
|
945 for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { |
|
946 delta = floor(delta / baseMinusTMin); |
|
947 } |
|
948 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); |
|
949 } |
|
950 |
|
951 /** |
|
952 * Converts a Punycode string of ASCII-only symbols to a string of Unicode |
|
953 * symbols. |
|
954 * @memberOf punycode |
|
955 * @param {String} input The Punycode string of ASCII-only symbols. |
|
956 * @returns {String} The resulting string of Unicode symbols. |
|
957 */ |
|
958 function decode(input) { |
|
959 // Don't use UCS-2 |
|
960 var output = [], |
|
961 inputLength = input.length, |
|
962 out, |
|
963 i = 0, |
|
964 n = initialN, |
|
965 bias = initialBias, |
|
966 basic, |
|
967 j, |
|
968 index, |
|
969 oldi, |
|
970 w, |
|
971 k, |
|
972 digit, |
|
973 t, |
|
974 /** Cached calculation results */ |
|
975 baseMinusT; |
|
976 |
|
977 // Handle the basic code points: let `basic` be the number of input code |
|
978 // points before the last delimiter, or `0` if there is none, then copy |
|
979 // the first basic code points to the output. |
|
980 |
|
981 basic = input.lastIndexOf(delimiter); |
|
982 if (basic < 0) { |
|
983 basic = 0; |
|
984 } |
|
985 |
|
986 for (j = 0; j < basic; ++j) { |
|
987 // if it's not a basic code point |
|
988 if (input.charCodeAt(j) >= 0x80) { |
|
989 error('not-basic'); |
|
990 } |
|
991 output.push(input.charCodeAt(j)); |
|
992 } |
|
993 |
|
994 // Main decoding loop: start just after the last delimiter if any basic code |
|
995 // points were copied; start at the beginning otherwise. |
|
996 |
|
997 for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { |
|
998 |
|
999 // `index` is the index of the next character to be consumed. |
|
1000 // Decode a generalized variable-length integer into `delta`, |
|
1001 // which gets added to `i`. The overflow checking is easier |
|
1002 // if we increase `i` as we go, then subtract off its starting |
|
1003 // value at the end to obtain `delta`. |
|
1004 for (oldi = i, w = 1, k = base; /* no condition */; k += base) { |
|
1005 |
|
1006 if (index >= inputLength) { |
|
1007 error('invalid-input'); |
|
1008 } |
|
1009 |
|
1010 digit = basicToDigit(input.charCodeAt(index++)); |
|
1011 |
|
1012 if (digit >= base || digit > floor((maxInt - i) / w)) { |
|
1013 error('overflow'); |
|
1014 } |
|
1015 |
|
1016 i += digit * w; |
|
1017 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); |
|
1018 |
|
1019 if (digit < t) { |
|
1020 break; |
|
1021 } |
|
1022 |
|
1023 baseMinusT = base - t; |
|
1024 if (w > floor(maxInt / baseMinusT)) { |
|
1025 error('overflow'); |
|
1026 } |
|
1027 |
|
1028 w *= baseMinusT; |
|
1029 |
|
1030 } |
|
1031 |
|
1032 out = output.length + 1; |
|
1033 bias = adapt(i - oldi, out, oldi == 0); |
|
1034 |
|
1035 // `i` was supposed to wrap around from `out` to `0`, |
|
1036 // incrementing `n` each time, so we'll fix that now: |
|
1037 if (floor(i / out) > maxInt - n) { |
|
1038 error('overflow'); |
|
1039 } |
|
1040 |
|
1041 n += floor(i / out); |
|
1042 i %= out; |
|
1043 |
|
1044 // Insert `n` at position `i` of the output |
|
1045 output.splice(i++, 0, n); |
|
1046 |
|
1047 } |
|
1048 |
|
1049 return ucs2encode(output); |
|
1050 } |
|
1051 |
|
1052 /** |
|
1053 * Converts a string of Unicode symbols (e.g. a domain name label) to a |
|
1054 * Punycode string of ASCII-only symbols. |
|
1055 * @memberOf punycode |
|
1056 * @param {String} input The string of Unicode symbols. |
|
1057 * @returns {String} The resulting Punycode string of ASCII-only symbols. |
|
1058 */ |
|
1059 function encode(input) { |
|
1060 var n, |
|
1061 delta, |
|
1062 handledCPCount, |
|
1063 basicLength, |
|
1064 bias, |
|
1065 j, |
|
1066 m, |
|
1067 q, |
|
1068 k, |
|
1069 t, |
|
1070 currentValue, |
|
1071 output = [], |
|
1072 /** `inputLength` will hold the number of code points in `input`. */ |
|
1073 inputLength, |
|
1074 /** Cached calculation results */ |
|
1075 handledCPCountPlusOne, |
|
1076 baseMinusT, |
|
1077 qMinusT; |
|
1078 |
|
1079 // Convert the input in UCS-2 to Unicode |
|
1080 input = ucs2decode(input); |
|
1081 |
|
1082 // Cache the length |
|
1083 inputLength = input.length; |
|
1084 |
|
1085 // Initialize the state |
|
1086 n = initialN; |
|
1087 delta = 0; |
|
1088 bias = initialBias; |
|
1089 |
|
1090 // Handle the basic code points |
|
1091 for (j = 0; j < inputLength; ++j) { |
|
1092 currentValue = input[j]; |
|
1093 if (currentValue < 0x80) { |
|
1094 output.push(stringFromCharCode(currentValue)); |
|
1095 } |
|
1096 } |
|
1097 |
|
1098 handledCPCount = basicLength = output.length; |
|
1099 |
|
1100 // `handledCPCount` is the number of code points that have been handled; |
|
1101 // `basicLength` is the number of basic code points. |
|
1102 |
|
1103 // Finish the basic string - if it is not empty - with a delimiter |
|
1104 if (basicLength) { |
|
1105 output.push(delimiter); |
|
1106 } |
|
1107 |
|
1108 // Main encoding loop: |
|
1109 while (handledCPCount < inputLength) { |
|
1110 |
|
1111 // All non-basic code points < n have been handled already. Find the next |
|
1112 // larger one: |
|
1113 for (m = maxInt, j = 0; j < inputLength; ++j) { |
|
1114 currentValue = input[j]; |
|
1115 if (currentValue >= n && currentValue < m) { |
|
1116 m = currentValue; |
|
1117 } |
|
1118 } |
|
1119 |
|
1120 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, |
|
1121 // but guard against overflow |
|
1122 handledCPCountPlusOne = handledCPCount + 1; |
|
1123 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { |
|
1124 error('overflow'); |
|
1125 } |
|
1126 |
|
1127 delta += (m - n) * handledCPCountPlusOne; |
|
1128 n = m; |
|
1129 |
|
1130 for (j = 0; j < inputLength; ++j) { |
|
1131 currentValue = input[j]; |
|
1132 |
|
1133 if (currentValue < n && ++delta > maxInt) { |
|
1134 error('overflow'); |
|
1135 } |
|
1136 |
|
1137 if (currentValue == n) { |
|
1138 // Represent delta as a generalized variable-length integer |
|
1139 for (q = delta, k = base; /* no condition */; k += base) { |
|
1140 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); |
|
1141 if (q < t) { |
|
1142 break; |
|
1143 } |
|
1144 qMinusT = q - t; |
|
1145 baseMinusT = base - t; |
|
1146 output.push( |
|
1147 stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) |
|
1148 ); |
|
1149 q = floor(qMinusT / baseMinusT); |
|
1150 } |
|
1151 |
|
1152 output.push(stringFromCharCode(digitToBasic(q, 0))); |
|
1153 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); |
|
1154 delta = 0; |
|
1155 ++handledCPCount; |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 ++delta; |
|
1160 ++n; |
|
1161 |
|
1162 } |
|
1163 return output.join(''); |
|
1164 } |
|
1165 |
|
1166 /** |
|
1167 * Converts a Punycode string representing a domain name or an email address |
|
1168 * to Unicode. Only the Punycoded parts of the input will be converted, i.e. |
|
1169 * it doesn't matter if you call it on a string that has already been |
|
1170 * converted to Unicode. |
|
1171 * @memberOf punycode |
|
1172 * @param {String} input The Punycoded domain name or email address to |
|
1173 * convert to Unicode. |
|
1174 * @returns {String} The Unicode representation of the given Punycode |
|
1175 * string. |
|
1176 */ |
|
1177 function toUnicode(input) { |
|
1178 return mapDomain(input, function(string) { |
|
1179 return regexPunycode.test(string) |
|
1180 ? decode(string.slice(4).toLowerCase()) |
|
1181 : string; |
|
1182 }); |
|
1183 } |
|
1184 |
|
1185 /** |
|
1186 * Converts a Unicode string representing a domain name or an email address to |
|
1187 * Punycode. Only the non-ASCII parts of the domain name will be converted, |
|
1188 * i.e. it doesn't matter if you call it with a domain that's already in |
|
1189 * ASCII. |
|
1190 * @memberOf punycode |
|
1191 * @param {String} input The domain name or email address to convert, as a |
|
1192 * Unicode string. |
|
1193 * @returns {String} The Punycode representation of the given domain name or |
|
1194 * email address. |
|
1195 */ |
|
1196 function toASCII(input) { |
|
1197 return mapDomain(input, function(string) { |
|
1198 return regexNonASCII.test(string) |
|
1199 ? 'xn--' + encode(string) |
|
1200 : string; |
|
1201 }); |
|
1202 } |
|
1203 |
|
1204 /*--------------------------------------------------------------------------*/ |
|
1205 |
|
1206 /** Define the public API */ |
|
1207 punycode = { |
|
1208 /** |
|
1209 * A string representing the current Punycode.js version number. |
|
1210 * @memberOf punycode |
|
1211 * @type String |
|
1212 */ |
|
1213 'version': '1.4.1', |
|
1214 /** |
|
1215 * An object of methods to convert from JavaScript's internal character |
|
1216 * representation (UCS-2) to Unicode code points, and back. |
|
1217 * @see <https://mathiasbynens.be/notes/javascript-encoding> |
|
1218 * @memberOf punycode |
|
1219 * @type Object |
|
1220 */ |
|
1221 'ucs2': { |
|
1222 'decode': ucs2decode, |
|
1223 'encode': ucs2encode |
|
1224 }, |
|
1225 'decode': decode, |
|
1226 'encode': encode, |
|
1227 'toASCII': toASCII, |
|
1228 'toUnicode': toUnicode |
|
1229 }; |
|
1230 |
|
1231 /** Expose `punycode` */ |
|
1232 // Some AMD build optimizers, like r.js, check for specific condition patterns |
|
1233 // like the following: |
|
1234 if ( |
|
1235 true |
|
1236 ) { |
|
1237 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { |
|
1238 return punycode; |
|
1239 }).call(exports, __webpack_require__, exports, module), |
|
1240 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
1241 } else {} |
|
1242 |
|
1243 }(this)); |
|
1244 |
|
1245 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(118)(module), __webpack_require__(59))) |
|
1246 |
1153 |
1247 /***/ }), |
1154 /***/ }), |
1248 |
1155 |
1249 /***/ 118: |
1156 /***/ 18: |
1157 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1158 |
|
1159 "use strict"; |
|
1160 |
|
1161 // EXPORTS |
|
1162 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); |
|
1163 |
|
1164 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
|
1165 var arrayLikeToArray = __webpack_require__(26); |
|
1166 |
|
1167 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
1168 |
|
1169 function _arrayWithoutHoles(arr) { |
|
1170 if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); |
|
1171 } |
|
1172 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
1173 var iterableToArray = __webpack_require__(35); |
|
1174 |
|
1175 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
1176 var unsupportedIterableToArray = __webpack_require__(29); |
|
1177 |
|
1178 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
1179 function _nonIterableSpread() { |
|
1180 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
1181 } |
|
1182 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 function _toConsumableArray(arr) { |
|
1188 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
1189 } |
|
1190 |
|
1191 /***/ }), |
|
1192 |
|
1193 /***/ 19: |
|
1194 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1195 |
|
1196 "use strict"; |
|
1197 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); |
|
1198 function _defineProperties(target, props) { |
|
1199 for (var i = 0; i < props.length; i++) { |
|
1200 var descriptor = props[i]; |
|
1201 descriptor.enumerable = descriptor.enumerable || false; |
|
1202 descriptor.configurable = true; |
|
1203 if ("value" in descriptor) descriptor.writable = true; |
|
1204 Object.defineProperty(target, descriptor.key, descriptor); |
|
1205 } |
|
1206 } |
|
1207 |
|
1208 function _createClass(Constructor, protoProps, staticProps) { |
|
1209 if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
1210 if (staticProps) _defineProperties(Constructor, staticProps); |
|
1211 return Constructor; |
|
1212 } |
|
1213 |
|
1214 /***/ }), |
|
1215 |
|
1216 /***/ 2: |
|
1250 /***/ (function(module, exports) { |
1217 /***/ (function(module, exports) { |
1251 |
1218 |
1252 module.exports = function(module) { |
1219 (function() { module.exports = this["lodash"]; }()); |
1253 if (!module.webpackPolyfill) { |
|
1254 module.deprecate = function() {}; |
|
1255 module.paths = []; |
|
1256 // module.parent = undefined by default |
|
1257 if (!module.children) module.children = []; |
|
1258 Object.defineProperty(module, "loaded", { |
|
1259 enumerable: true, |
|
1260 get: function() { |
|
1261 return module.l; |
|
1262 } |
|
1263 }); |
|
1264 Object.defineProperty(module, "id", { |
|
1265 enumerable: true, |
|
1266 get: function() { |
|
1267 return module.i; |
|
1268 } |
|
1269 }); |
|
1270 module.webpackPolyfill = 1; |
|
1271 } |
|
1272 return module; |
|
1273 }; |
|
1274 |
|
1275 |
1220 |
1276 /***/ }), |
1221 /***/ }), |
1277 |
1222 |
1278 /***/ 119: |
1223 /***/ 20: |
1279 /***/ (function(module, exports, __webpack_require__) { |
1224 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1280 |
1225 |
1281 "use strict"; |
1226 "use strict"; |
1282 |
1227 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); |
1283 |
1228 function _classCallCheck(instance, Constructor) { |
1284 module.exports = { |
1229 if (!(instance instanceof Constructor)) { |
1285 isString: function(arg) { |
1230 throw new TypeError("Cannot call a class as a function"); |
1286 return typeof(arg) === 'string'; |
|
1287 }, |
|
1288 isObject: function(arg) { |
|
1289 return typeof(arg) === 'object' && arg !== null; |
|
1290 }, |
|
1291 isNull: function(arg) { |
|
1292 return arg === null; |
|
1293 }, |
|
1294 isNullOrUndefined: function(arg) { |
|
1295 return arg == null; |
|
1296 } |
1231 } |
1297 }; |
1232 } |
1298 |
|
1299 |
1233 |
1300 /***/ }), |
1234 /***/ }), |
1301 |
1235 |
1302 /***/ 12: |
1236 /***/ 202: |
1303 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1237 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1304 |
1238 |
1305 "use strict"; |
1239 "use strict"; |
1306 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); |
1240 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
1307 function _getPrototypeOf(o) { |
1241 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
1308 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { |
1242 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
1309 return o.__proto__ || Object.getPrototypeOf(o); |
1243 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
1310 }; |
1244 |
1311 return _getPrototypeOf(o); |
1245 |
1312 } |
1246 /** |
1247 * WordPress dependencies |
|
1248 */ |
|
1249 |
|
1250 var blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
1251 xmlns: "http://www.w3.org/2000/svg", |
|
1252 viewBox: "0 0 24 24" |
|
1253 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
1254 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" |
|
1255 })); |
|
1256 /* harmony default export */ __webpack_exports__["a"] = (blockDefault); |
|
1257 |
|
1313 |
1258 |
1314 /***/ }), |
1259 /***/ }), |
1315 |
1260 |
1316 /***/ 120: |
1261 /***/ 21: |
1317 /***/ (function(module, exports, __webpack_require__) { |
1262 /***/ (function(module, exports) { |
1263 |
|
1264 (function() { module.exports = this["wp"]["keycodes"]; }()); |
|
1265 |
|
1266 /***/ }), |
|
1267 |
|
1268 /***/ 22: |
|
1269 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1318 |
1270 |
1319 "use strict"; |
1271 "use strict"; |
1320 |
1272 |
1321 |
1273 // EXPORTS |
1322 exports.decode = exports.parse = __webpack_require__(121); |
1274 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); |
1323 exports.encode = exports.stringify = __webpack_require__(122); |
|
1324 |
|
1325 |
|
1326 /***/ }), |
|
1327 |
|
1328 /***/ 121: |
|
1329 /***/ (function(module, exports, __webpack_require__) { |
|
1330 |
|
1331 "use strict"; |
|
1332 // Copyright Joyent, Inc. and other Node contributors. |
|
1333 // |
|
1334 // Permission is hereby granted, free of charge, to any person obtaining a |
|
1335 // copy of this software and associated documentation files (the |
|
1336 // "Software"), to deal in the Software without restriction, including |
|
1337 // without limitation the rights to use, copy, modify, merge, publish, |
|
1338 // distribute, sublicense, and/or sell copies of the Software, and to permit |
|
1339 // persons to whom the Software is furnished to do so, subject to the |
|
1340 // following conditions: |
|
1341 // |
|
1342 // The above copyright notice and this permission notice shall be included |
|
1343 // in all copies or substantial portions of the Software. |
|
1344 // |
|
1345 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
1346 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
1347 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN |
|
1348 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
1349 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
1350 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|
1351 // USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
1352 |
|
1353 |
|
1354 |
|
1355 // If obj.hasOwnProperty has been overridden, then calling |
|
1356 // obj.hasOwnProperty(prop) will break. |
|
1357 // See: https://github.com/joyent/node/issues/1707 |
|
1358 function hasOwnProperty(obj, prop) { |
|
1359 return Object.prototype.hasOwnProperty.call(obj, prop); |
|
1360 } |
|
1361 |
|
1362 module.exports = function(qs, sep, eq, options) { |
|
1363 sep = sep || '&'; |
|
1364 eq = eq || '='; |
|
1365 var obj = {}; |
|
1366 |
|
1367 if (typeof qs !== 'string' || qs.length === 0) { |
|
1368 return obj; |
|
1369 } |
|
1370 |
|
1371 var regexp = /\+/g; |
|
1372 qs = qs.split(sep); |
|
1373 |
|
1374 var maxKeys = 1000; |
|
1375 if (options && typeof options.maxKeys === 'number') { |
|
1376 maxKeys = options.maxKeys; |
|
1377 } |
|
1378 |
|
1379 var len = qs.length; |
|
1380 // maxKeys <= 0 means that we should not limit keys count |
|
1381 if (maxKeys > 0 && len > maxKeys) { |
|
1382 len = maxKeys; |
|
1383 } |
|
1384 |
|
1385 for (var i = 0; i < len; ++i) { |
|
1386 var x = qs[i].replace(regexp, '%20'), |
|
1387 idx = x.indexOf(eq), |
|
1388 kstr, vstr, k, v; |
|
1389 |
|
1390 if (idx >= 0) { |
|
1391 kstr = x.substr(0, idx); |
|
1392 vstr = x.substr(idx + 1); |
|
1393 } else { |
|
1394 kstr = x; |
|
1395 vstr = ''; |
|
1396 } |
|
1397 |
|
1398 k = decodeURIComponent(kstr); |
|
1399 v = decodeURIComponent(vstr); |
|
1400 |
|
1401 if (!hasOwnProperty(obj, k)) { |
|
1402 obj[k] = v; |
|
1403 } else if (isArray(obj[k])) { |
|
1404 obj[k].push(v); |
|
1405 } else { |
|
1406 obj[k] = [obj[k], v]; |
|
1407 } |
|
1408 } |
|
1409 |
|
1410 return obj; |
|
1411 }; |
|
1412 |
|
1413 var isArray = Array.isArray || function (xs) { |
|
1414 return Object.prototype.toString.call(xs) === '[object Array]'; |
|
1415 }; |
|
1416 |
|
1417 |
|
1418 /***/ }), |
|
1419 |
|
1420 /***/ 122: |
|
1421 /***/ (function(module, exports, __webpack_require__) { |
|
1422 |
|
1423 "use strict"; |
|
1424 // Copyright Joyent, Inc. and other Node contributors. |
|
1425 // |
|
1426 // Permission is hereby granted, free of charge, to any person obtaining a |
|
1427 // copy of this software and associated documentation files (the |
|
1428 // "Software"), to deal in the Software without restriction, including |
|
1429 // without limitation the rights to use, copy, modify, merge, publish, |
|
1430 // distribute, sublicense, and/or sell copies of the Software, and to permit |
|
1431 // persons to whom the Software is furnished to do so, subject to the |
|
1432 // following conditions: |
|
1433 // |
|
1434 // The above copyright notice and this permission notice shall be included |
|
1435 // in all copies or substantial portions of the Software. |
|
1436 // |
|
1437 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
1438 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
1439 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN |
|
1440 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
1441 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
1442 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|
1443 // USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
1444 |
|
1445 |
|
1446 |
|
1447 var stringifyPrimitive = function(v) { |
|
1448 switch (typeof v) { |
|
1449 case 'string': |
|
1450 return v; |
|
1451 |
|
1452 case 'boolean': |
|
1453 return v ? 'true' : 'false'; |
|
1454 |
|
1455 case 'number': |
|
1456 return isFinite(v) ? v : ''; |
|
1457 |
|
1458 default: |
|
1459 return ''; |
|
1460 } |
|
1461 }; |
|
1462 |
|
1463 module.exports = function(obj, sep, eq, name) { |
|
1464 sep = sep || '&'; |
|
1465 eq = eq || '='; |
|
1466 if (obj === null) { |
|
1467 obj = undefined; |
|
1468 } |
|
1469 |
|
1470 if (typeof obj === 'object') { |
|
1471 return map(objectKeys(obj), function(k) { |
|
1472 var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; |
|
1473 if (isArray(obj[k])) { |
|
1474 return map(obj[k], function(v) { |
|
1475 return ks + encodeURIComponent(stringifyPrimitive(v)); |
|
1476 }).join(sep); |
|
1477 } else { |
|
1478 return ks + encodeURIComponent(stringifyPrimitive(obj[k])); |
|
1479 } |
|
1480 }).join(sep); |
|
1481 |
|
1482 } |
|
1483 |
|
1484 if (!name) return ''; |
|
1485 return encodeURIComponent(stringifyPrimitive(name)) + eq + |
|
1486 encodeURIComponent(stringifyPrimitive(obj)); |
|
1487 }; |
|
1488 |
|
1489 var isArray = Array.isArray || function (xs) { |
|
1490 return Object.prototype.toString.call(xs) === '[object Array]'; |
|
1491 }; |
|
1492 |
|
1493 function map (xs, f) { |
|
1494 if (xs.map) return xs.map(f); |
|
1495 var res = []; |
|
1496 for (var i = 0; i < xs.length; i++) { |
|
1497 res.push(f(xs[i], i)); |
|
1498 } |
|
1499 return res; |
|
1500 } |
|
1501 |
|
1502 var objectKeys = Object.keys || function (obj) { |
|
1503 var res = []; |
|
1504 for (var key in obj) { |
|
1505 if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); |
|
1506 } |
|
1507 return res; |
|
1508 }; |
|
1509 |
|
1510 |
|
1511 /***/ }), |
|
1512 |
|
1513 /***/ 13: |
|
1514 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1515 |
|
1516 "use strict"; |
|
1517 |
1275 |
1518 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
1276 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
1519 function _setPrototypeOf(o, p) { |
1277 function _setPrototypeOf(o, p) { |
1520 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { |
1278 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { |
1521 o.__proto__ = p; |
1279 o.__proto__ = p; |
1523 }; |
1281 }; |
1524 |
1282 |
1525 return _setPrototypeOf(o, p); |
1283 return _setPrototypeOf(o, p); |
1526 } |
1284 } |
1527 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js |
1285 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js |
1528 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; }); |
|
1529 |
1286 |
1530 function _inherits(subClass, superClass) { |
1287 function _inherits(subClass, superClass) { |
1531 if (typeof superClass !== "function" && superClass !== null) { |
1288 if (typeof superClass !== "function" && superClass !== null) { |
1532 throw new TypeError("Super expression must either be null or a function"); |
1289 throw new TypeError("Super expression must either be null or a function"); |
1533 } |
1290 } |
1542 if (superClass) _setPrototypeOf(subClass, superClass); |
1299 if (superClass) _setPrototypeOf(subClass, superClass); |
1543 } |
1300 } |
1544 |
1301 |
1545 /***/ }), |
1302 /***/ }), |
1546 |
1303 |
1547 /***/ 133: |
1304 /***/ 23: |
1305 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1306 |
|
1307 "use strict"; |
|
1308 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); |
|
1309 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); |
|
1310 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); |
|
1311 |
|
1312 |
|
1313 function _possibleConstructorReturn(self, call) { |
|
1314 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { |
|
1315 return call; |
|
1316 } |
|
1317 |
|
1318 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); |
|
1319 } |
|
1320 |
|
1321 /***/ }), |
|
1322 |
|
1323 /***/ 24: |
|
1548 /***/ (function(module, exports) { |
1324 /***/ (function(module, exports) { |
1549 |
1325 |
1550 (function() { module.exports = this["wp"]["notices"]; }()); |
1326 (function() { module.exports = this["regeneratorRuntime"]; }()); |
1551 |
1327 |
1552 /***/ }), |
1328 /***/ }), |
1553 |
1329 |
1554 /***/ 14: |
1330 /***/ 25: |
1555 /***/ (function(module, exports) { |
1331 /***/ (function(module, exports) { |
1556 |
1332 |
1557 (function() { module.exports = this["wp"]["blocks"]; }()); |
1333 (function() { module.exports = this["wp"]["richText"]; }()); |
1558 |
1334 |
1559 /***/ }), |
1335 /***/ }), |
1560 |
1336 |
1561 /***/ 15: |
1337 /***/ 26: |
1562 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1338 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1563 |
1339 |
1564 "use strict"; |
1340 "use strict"; |
1565 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
1341 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
1566 function _defineProperty(obj, key, value) { |
1342 function _arrayLikeToArray(arr, len) { |
1567 if (key in obj) { |
1343 if (len == null || len > arr.length) len = arr.length; |
1568 Object.defineProperty(obj, key, { |
1344 |
1569 value: value, |
1345 for (var i = 0, arr2 = new Array(len); i < len; i++) { |
1570 enumerable: true, |
1346 arr2[i] = arr[i]; |
1571 configurable: true, |
1347 } |
1572 writable: true |
1348 |
1573 }); |
1349 return arr2; |
1350 } |
|
1351 |
|
1352 /***/ }), |
|
1353 |
|
1354 /***/ 28: |
|
1355 /***/ (function(module, exports, __webpack_require__) { |
|
1356 |
|
1357 /** |
|
1358 * Copyright (c) 2013-present, Facebook, Inc. |
|
1359 * |
|
1360 * This source code is licensed under the MIT license found in the |
|
1361 * LICENSE file in the root directory of this source tree. |
|
1362 */ |
|
1363 |
|
1364 if (false) { var throwOnDirectAccess, ReactIs; } else { |
|
1365 // By explicitly using `prop-types` you are opting into new production behavior. |
|
1366 // http://fb.me/prop-types-in-prod |
|
1367 module.exports = __webpack_require__(138)(); |
|
1368 } |
|
1369 |
|
1370 |
|
1371 /***/ }), |
|
1372 |
|
1373 /***/ 29: |
|
1374 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1375 |
|
1376 "use strict"; |
|
1377 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
|
1378 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
|
1379 |
|
1380 function _unsupportedIterableToArray(o, minLen) { |
|
1381 if (!o) return; |
|
1382 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
1383 var n = Object.prototype.toString.call(o).slice(8, -1); |
|
1384 if (n === "Object" && o.constructor) n = o.constructor.name; |
|
1385 if (n === "Map" || n === "Set") return Array.from(o); |
|
1386 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
1387 } |
|
1388 |
|
1389 /***/ }), |
|
1390 |
|
1391 /***/ 298: |
|
1392 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1393 |
|
1394 "use strict"; |
|
1395 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
1396 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
1397 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
|
1398 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
1399 |
|
1400 |
|
1401 /** |
|
1402 * WordPress dependencies |
|
1403 */ |
|
1404 |
|
1405 var layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
1406 xmlns: "http://www.w3.org/2000/svg", |
|
1407 viewBox: "-2 -2 24 24" |
|
1408 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
1409 d: "M2 2h5v11H2V2zm6 0h5v5H8V2zm6 0h4v16h-4V2zM8 8h5v5H8V8zm-6 6h11v4H2v-4z" |
|
1410 })); |
|
1411 /* harmony default export */ __webpack_exports__["a"] = (layout); |
|
1412 |
|
1413 |
|
1414 /***/ }), |
|
1415 |
|
1416 /***/ 3: |
|
1417 /***/ (function(module, exports) { |
|
1418 |
|
1419 (function() { module.exports = this["wp"]["components"]; }()); |
|
1420 |
|
1421 /***/ }), |
|
1422 |
|
1423 /***/ 302: |
|
1424 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1425 |
|
1426 "use strict"; |
|
1427 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
1428 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
1429 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
|
1430 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
1431 |
|
1432 |
|
1433 /** |
|
1434 * WordPress dependencies |
|
1435 */ |
|
1436 |
|
1437 var grid = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
1438 xmlns: "http://www.w3.org/2000/svg", |
|
1439 viewBox: "-2 -2 24 24" |
|
1440 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
1441 d: "M9 9V3H3v6h6zm8 0V3h-6v6h6zm-8 8v-6H3v6h6zm8 0v-6h-6v6h6z" |
|
1442 })); |
|
1443 /* harmony default export */ __webpack_exports__["a"] = (grid); |
|
1444 |
|
1445 |
|
1446 /***/ }), |
|
1447 |
|
1448 /***/ 31: |
|
1449 /***/ (function(module, exports) { |
|
1450 |
|
1451 (function() { module.exports = this["wp"]["url"]; }()); |
|
1452 |
|
1453 /***/ }), |
|
1454 |
|
1455 /***/ 32: |
|
1456 /***/ (function(module, exports) { |
|
1457 |
|
1458 (function() { module.exports = this["wp"]["hooks"]; }()); |
|
1459 |
|
1460 /***/ }), |
|
1461 |
|
1462 /***/ 35: |
|
1463 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1464 |
|
1465 "use strict"; |
|
1466 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
1467 function _iterableToArray(iter) { |
|
1468 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
|
1469 } |
|
1470 |
|
1471 /***/ }), |
|
1472 |
|
1473 /***/ 36: |
|
1474 /***/ (function(module, exports) { |
|
1475 |
|
1476 (function() { module.exports = this["wp"]["dataControls"]; }()); |
|
1477 |
|
1478 /***/ }), |
|
1479 |
|
1480 /***/ 37: |
|
1481 /***/ (function(module, exports) { |
|
1482 |
|
1483 (function() { module.exports = this["wp"]["deprecated"]; }()); |
|
1484 |
|
1485 /***/ }), |
|
1486 |
|
1487 /***/ 38: |
|
1488 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1489 |
|
1490 "use strict"; |
|
1491 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
|
1492 function _arrayWithHoles(arr) { |
|
1493 if (Array.isArray(arr)) return arr; |
|
1494 } |
|
1495 |
|
1496 /***/ }), |
|
1497 |
|
1498 /***/ 39: |
|
1499 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1500 |
|
1501 "use strict"; |
|
1502 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
|
1503 function _nonIterableRest() { |
|
1504 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
1505 } |
|
1506 |
|
1507 /***/ }), |
|
1508 |
|
1509 /***/ 4: |
|
1510 /***/ (function(module, exports) { |
|
1511 |
|
1512 (function() { module.exports = this["wp"]["data"]; }()); |
|
1513 |
|
1514 /***/ }), |
|
1515 |
|
1516 /***/ 40: |
|
1517 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1518 |
|
1519 "use strict"; |
|
1520 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
|
1521 function _typeof(obj) { |
|
1522 "@babel/helpers - typeof"; |
|
1523 |
|
1524 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { |
|
1525 _typeof = function _typeof(obj) { |
|
1526 return typeof obj; |
|
1527 }; |
|
1574 } else { |
1528 } else { |
1575 obj[key] = value; |
1529 _typeof = function _typeof(obj) { |
1530 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
|
1531 }; |
|
1576 } |
1532 } |
1577 |
1533 |
1578 return obj; |
1534 return _typeof(obj); |
1579 } |
1535 } |
1580 |
1536 |
1581 /***/ }), |
1537 /***/ }), |
1582 |
1538 |
1583 /***/ 16: |
1539 /***/ 41: |
1584 /***/ (function(module, exports, __webpack_require__) { |
|
1585 |
|
1586 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
1587 Copyright (c) 2017 Jed Watson. |
|
1588 Licensed under the MIT License (MIT), see |
|
1589 http://jedwatson.github.io/classnames |
|
1590 */ |
|
1591 /* global define */ |
|
1592 |
|
1593 (function () { |
|
1594 'use strict'; |
|
1595 |
|
1596 var hasOwn = {}.hasOwnProperty; |
|
1597 |
|
1598 function classNames () { |
|
1599 var classes = []; |
|
1600 |
|
1601 for (var i = 0; i < arguments.length; i++) { |
|
1602 var arg = arguments[i]; |
|
1603 if (!arg) continue; |
|
1604 |
|
1605 var argType = typeof arg; |
|
1606 |
|
1607 if (argType === 'string' || argType === 'number') { |
|
1608 classes.push(arg); |
|
1609 } else if (Array.isArray(arg) && arg.length) { |
|
1610 var inner = classNames.apply(null, arg); |
|
1611 if (inner) { |
|
1612 classes.push(inner); |
|
1613 } |
|
1614 } else if (argType === 'object') { |
|
1615 for (var key in arg) { |
|
1616 if (hasOwn.call(arg, key) && arg[key]) { |
|
1617 classes.push(key); |
|
1618 } |
|
1619 } |
|
1620 } |
|
1621 } |
|
1622 |
|
1623 return classes.join(' '); |
|
1624 } |
|
1625 |
|
1626 if ( true && module.exports) { |
|
1627 classNames.default = classNames; |
|
1628 module.exports = classNames; |
|
1629 } else if (true) { |
|
1630 // register as 'classnames', consistent with npm package name |
|
1631 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
1632 return classNames; |
|
1633 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
1634 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
1635 } else {} |
|
1636 }()); |
|
1637 |
|
1638 |
|
1639 /***/ }), |
|
1640 |
|
1641 /***/ 17: |
|
1642 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1540 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1643 |
1541 |
1644 "use strict"; |
1542 "use strict"; |
1645 |
1543 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); |
1646 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
1647 function _arrayWithoutHoles(arr) { |
|
1648 if (Array.isArray(arr)) { |
|
1649 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { |
|
1650 arr2[i] = arr[i]; |
|
1651 } |
|
1652 |
|
1653 return arr2; |
|
1654 } |
|
1655 } |
|
1656 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
1657 var iterableToArray = __webpack_require__(34); |
|
1658 |
|
1659 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
1660 function _nonIterableSpread() { |
|
1661 throw new TypeError("Invalid attempt to spread non-iterable instance"); |
|
1662 } |
|
1663 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
1664 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); |
|
1665 |
|
1666 |
|
1667 |
|
1668 function _toConsumableArray(arr) { |
|
1669 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
1670 } |
|
1671 |
|
1672 /***/ }), |
|
1673 |
|
1674 /***/ 18: |
|
1675 /***/ (function(module, exports) { |
|
1676 |
|
1677 (function() { module.exports = this["wp"]["keycodes"]; }()); |
|
1678 |
|
1679 /***/ }), |
|
1680 |
|
1681 /***/ 19: |
|
1682 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1683 |
|
1684 "use strict"; |
|
1685 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
1686 function _extends() { |
|
1687 _extends = Object.assign || function (target) { |
|
1688 for (var i = 1; i < arguments.length; i++) { |
|
1689 var source = arguments[i]; |
|
1690 |
|
1691 for (var key in source) { |
|
1692 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
1693 target[key] = source[key]; |
|
1694 } |
|
1695 } |
|
1696 } |
|
1697 |
|
1698 return target; |
|
1699 }; |
|
1700 |
|
1701 return _extends.apply(this, arguments); |
|
1702 } |
|
1703 |
|
1704 /***/ }), |
|
1705 |
|
1706 /***/ 2: |
|
1707 /***/ (function(module, exports) { |
|
1708 |
|
1709 (function() { module.exports = this["lodash"]; }()); |
|
1710 |
|
1711 /***/ }), |
|
1712 |
|
1713 /***/ 20: |
|
1714 /***/ (function(module, exports) { |
|
1715 |
|
1716 (function() { module.exports = this["wp"]["richText"]; }()); |
|
1717 |
|
1718 /***/ }), |
|
1719 |
|
1720 /***/ 21: |
|
1721 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1722 |
|
1723 "use strict"; |
|
1724 |
|
1725 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js |
|
1726 function _objectWithoutPropertiesLoose(source, excluded) { |
1544 function _objectWithoutPropertiesLoose(source, excluded) { |
1727 if (source == null) return {}; |
1545 if (source == null) return {}; |
1728 var target = {}; |
1546 var target = {}; |
1729 var sourceKeys = Object.keys(source); |
1547 var sourceKeys = Object.keys(source); |
1730 var key, i; |
1548 var key, i; |
1735 target[key] = source[key]; |
1553 target[key] = source[key]; |
1736 } |
1554 } |
1737 |
1555 |
1738 return target; |
1556 return target; |
1739 } |
1557 } |
1740 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
1741 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
|
1742 |
|
1743 function _objectWithoutProperties(source, excluded) { |
|
1744 if (source == null) return {}; |
|
1745 var target = _objectWithoutPropertiesLoose(source, excluded); |
|
1746 var key, i; |
|
1747 |
|
1748 if (Object.getOwnPropertySymbols) { |
|
1749 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
1750 |
|
1751 for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
1752 key = sourceSymbolKeys[i]; |
|
1753 if (excluded.indexOf(key) >= 0) continue; |
|
1754 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
1755 target[key] = source[key]; |
|
1756 } |
|
1757 } |
|
1758 |
|
1759 return target; |
|
1760 } |
|
1761 |
1558 |
1762 /***/ }), |
1559 /***/ }), |
1763 |
1560 |
1764 /***/ 227: |
1561 /***/ 42: |
1765 /***/ (function(module, exports) { |
|
1766 |
|
1767 var traverse = module.exports = function (obj) { |
|
1768 return new Traverse(obj); |
|
1769 }; |
|
1770 |
|
1771 function Traverse (obj) { |
|
1772 this.value = obj; |
|
1773 } |
|
1774 |
|
1775 Traverse.prototype.get = function (ps) { |
|
1776 var node = this.value; |
|
1777 for (var i = 0; i < ps.length; i ++) { |
|
1778 var key = ps[i]; |
|
1779 if (!node || !hasOwnProperty.call(node, key)) { |
|
1780 node = undefined; |
|
1781 break; |
|
1782 } |
|
1783 node = node[key]; |
|
1784 } |
|
1785 return node; |
|
1786 }; |
|
1787 |
|
1788 Traverse.prototype.has = function (ps) { |
|
1789 var node = this.value; |
|
1790 for (var i = 0; i < ps.length; i ++) { |
|
1791 var key = ps[i]; |
|
1792 if (!node || !hasOwnProperty.call(node, key)) { |
|
1793 return false; |
|
1794 } |
|
1795 node = node[key]; |
|
1796 } |
|
1797 return true; |
|
1798 }; |
|
1799 |
|
1800 Traverse.prototype.set = function (ps, value) { |
|
1801 var node = this.value; |
|
1802 for (var i = 0; i < ps.length - 1; i ++) { |
|
1803 var key = ps[i]; |
|
1804 if (!hasOwnProperty.call(node, key)) node[key] = {}; |
|
1805 node = node[key]; |
|
1806 } |
|
1807 node[ps[i]] = value; |
|
1808 return value; |
|
1809 }; |
|
1810 |
|
1811 Traverse.prototype.map = function (cb) { |
|
1812 return walk(this.value, cb, true); |
|
1813 }; |
|
1814 |
|
1815 Traverse.prototype.forEach = function (cb) { |
|
1816 this.value = walk(this.value, cb, false); |
|
1817 return this.value; |
|
1818 }; |
|
1819 |
|
1820 Traverse.prototype.reduce = function (cb, init) { |
|
1821 var skip = arguments.length === 1; |
|
1822 var acc = skip ? this.value : init; |
|
1823 this.forEach(function (x) { |
|
1824 if (!this.isRoot || !skip) { |
|
1825 acc = cb.call(this, acc, x); |
|
1826 } |
|
1827 }); |
|
1828 return acc; |
|
1829 }; |
|
1830 |
|
1831 Traverse.prototype.paths = function () { |
|
1832 var acc = []; |
|
1833 this.forEach(function (x) { |
|
1834 acc.push(this.path); |
|
1835 }); |
|
1836 return acc; |
|
1837 }; |
|
1838 |
|
1839 Traverse.prototype.nodes = function () { |
|
1840 var acc = []; |
|
1841 this.forEach(function (x) { |
|
1842 acc.push(this.node); |
|
1843 }); |
|
1844 return acc; |
|
1845 }; |
|
1846 |
|
1847 Traverse.prototype.clone = function () { |
|
1848 var parents = [], nodes = []; |
|
1849 |
|
1850 return (function clone (src) { |
|
1851 for (var i = 0; i < parents.length; i++) { |
|
1852 if (parents[i] === src) { |
|
1853 return nodes[i]; |
|
1854 } |
|
1855 } |
|
1856 |
|
1857 if (typeof src === 'object' && src !== null) { |
|
1858 var dst = copy(src); |
|
1859 |
|
1860 parents.push(src); |
|
1861 nodes.push(dst); |
|
1862 |
|
1863 forEach(objectKeys(src), function (key) { |
|
1864 dst[key] = clone(src[key]); |
|
1865 }); |
|
1866 |
|
1867 parents.pop(); |
|
1868 nodes.pop(); |
|
1869 return dst; |
|
1870 } |
|
1871 else { |
|
1872 return src; |
|
1873 } |
|
1874 })(this.value); |
|
1875 }; |
|
1876 |
|
1877 function walk (root, cb, immutable) { |
|
1878 var path = []; |
|
1879 var parents = []; |
|
1880 var alive = true; |
|
1881 |
|
1882 return (function walker (node_) { |
|
1883 var node = immutable ? copy(node_) : node_; |
|
1884 var modifiers = {}; |
|
1885 |
|
1886 var keepGoing = true; |
|
1887 |
|
1888 var state = { |
|
1889 node : node, |
|
1890 node_ : node_, |
|
1891 path : [].concat(path), |
|
1892 parent : parents[parents.length - 1], |
|
1893 parents : parents, |
|
1894 key : path.slice(-1)[0], |
|
1895 isRoot : path.length === 0, |
|
1896 level : path.length, |
|
1897 circular : null, |
|
1898 update : function (x, stopHere) { |
|
1899 if (!state.isRoot) { |
|
1900 state.parent.node[state.key] = x; |
|
1901 } |
|
1902 state.node = x; |
|
1903 if (stopHere) keepGoing = false; |
|
1904 }, |
|
1905 'delete' : function (stopHere) { |
|
1906 delete state.parent.node[state.key]; |
|
1907 if (stopHere) keepGoing = false; |
|
1908 }, |
|
1909 remove : function (stopHere) { |
|
1910 if (isArray(state.parent.node)) { |
|
1911 state.parent.node.splice(state.key, 1); |
|
1912 } |
|
1913 else { |
|
1914 delete state.parent.node[state.key]; |
|
1915 } |
|
1916 if (stopHere) keepGoing = false; |
|
1917 }, |
|
1918 keys : null, |
|
1919 before : function (f) { modifiers.before = f }, |
|
1920 after : function (f) { modifiers.after = f }, |
|
1921 pre : function (f) { modifiers.pre = f }, |
|
1922 post : function (f) { modifiers.post = f }, |
|
1923 stop : function () { alive = false }, |
|
1924 block : function () { keepGoing = false } |
|
1925 }; |
|
1926 |
|
1927 if (!alive) return state; |
|
1928 |
|
1929 function updateState() { |
|
1930 if (typeof state.node === 'object' && state.node !== null) { |
|
1931 if (!state.keys || state.node_ !== state.node) { |
|
1932 state.keys = objectKeys(state.node) |
|
1933 } |
|
1934 |
|
1935 state.isLeaf = state.keys.length == 0; |
|
1936 |
|
1937 for (var i = 0; i < parents.length; i++) { |
|
1938 if (parents[i].node_ === node_) { |
|
1939 state.circular = parents[i]; |
|
1940 break; |
|
1941 } |
|
1942 } |
|
1943 } |
|
1944 else { |
|
1945 state.isLeaf = true; |
|
1946 state.keys = null; |
|
1947 } |
|
1948 |
|
1949 state.notLeaf = !state.isLeaf; |
|
1950 state.notRoot = !state.isRoot; |
|
1951 } |
|
1952 |
|
1953 updateState(); |
|
1954 |
|
1955 // use return values to update if defined |
|
1956 var ret = cb.call(state, state.node); |
|
1957 if (ret !== undefined && state.update) state.update(ret); |
|
1958 |
|
1959 if (modifiers.before) modifiers.before.call(state, state.node); |
|
1960 |
|
1961 if (!keepGoing) return state; |
|
1962 |
|
1963 if (typeof state.node == 'object' |
|
1964 && state.node !== null && !state.circular) { |
|
1965 parents.push(state); |
|
1966 |
|
1967 updateState(); |
|
1968 |
|
1969 forEach(state.keys, function (key, i) { |
|
1970 path.push(key); |
|
1971 |
|
1972 if (modifiers.pre) modifiers.pre.call(state, state.node[key], key); |
|
1973 |
|
1974 var child = walker(state.node[key]); |
|
1975 if (immutable && hasOwnProperty.call(state.node, key)) { |
|
1976 state.node[key] = child.node; |
|
1977 } |
|
1978 |
|
1979 child.isLast = i == state.keys.length - 1; |
|
1980 child.isFirst = i == 0; |
|
1981 |
|
1982 if (modifiers.post) modifiers.post.call(state, child); |
|
1983 |
|
1984 path.pop(); |
|
1985 }); |
|
1986 parents.pop(); |
|
1987 } |
|
1988 |
|
1989 if (modifiers.after) modifiers.after.call(state, state.node); |
|
1990 |
|
1991 return state; |
|
1992 })(root).node; |
|
1993 } |
|
1994 |
|
1995 function copy (src) { |
|
1996 if (typeof src === 'object' && src !== null) { |
|
1997 var dst; |
|
1998 |
|
1999 if (isArray(src)) { |
|
2000 dst = []; |
|
2001 } |
|
2002 else if (isDate(src)) { |
|
2003 dst = new Date(src.getTime ? src.getTime() : src); |
|
2004 } |
|
2005 else if (isRegExp(src)) { |
|
2006 dst = new RegExp(src); |
|
2007 } |
|
2008 else if (isError(src)) { |
|
2009 dst = { message: src.message }; |
|
2010 } |
|
2011 else if (isBoolean(src)) { |
|
2012 dst = new Boolean(src); |
|
2013 } |
|
2014 else if (isNumber(src)) { |
|
2015 dst = new Number(src); |
|
2016 } |
|
2017 else if (isString(src)) { |
|
2018 dst = new String(src); |
|
2019 } |
|
2020 else if (Object.create && Object.getPrototypeOf) { |
|
2021 dst = Object.create(Object.getPrototypeOf(src)); |
|
2022 } |
|
2023 else if (src.constructor === Object) { |
|
2024 dst = {}; |
|
2025 } |
|
2026 else { |
|
2027 var proto = |
|
2028 (src.constructor && src.constructor.prototype) |
|
2029 || src.__proto__ |
|
2030 || {} |
|
2031 ; |
|
2032 var T = function () {}; |
|
2033 T.prototype = proto; |
|
2034 dst = new T; |
|
2035 } |
|
2036 |
|
2037 forEach(objectKeys(src), function (key) { |
|
2038 dst[key] = src[key]; |
|
2039 }); |
|
2040 return dst; |
|
2041 } |
|
2042 else return src; |
|
2043 } |
|
2044 |
|
2045 var objectKeys = Object.keys || function keys (obj) { |
|
2046 var res = []; |
|
2047 for (var key in obj) res.push(key) |
|
2048 return res; |
|
2049 }; |
|
2050 |
|
2051 function toS (obj) { return Object.prototype.toString.call(obj) } |
|
2052 function isDate (obj) { return toS(obj) === '[object Date]' } |
|
2053 function isRegExp (obj) { return toS(obj) === '[object RegExp]' } |
|
2054 function isError (obj) { return toS(obj) === '[object Error]' } |
|
2055 function isBoolean (obj) { return toS(obj) === '[object Boolean]' } |
|
2056 function isNumber (obj) { return toS(obj) === '[object Number]' } |
|
2057 function isString (obj) { return toS(obj) === '[object String]' } |
|
2058 |
|
2059 var isArray = Array.isArray || function isArray (xs) { |
|
2060 return Object.prototype.toString.call(xs) === '[object Array]'; |
|
2061 }; |
|
2062 |
|
2063 var forEach = function (xs, fn) { |
|
2064 if (xs.forEach) return xs.forEach(fn) |
|
2065 else for (var i = 0; i < xs.length; i++) { |
|
2066 fn(xs[i], i, xs); |
|
2067 } |
|
2068 }; |
|
2069 |
|
2070 forEach(objectKeys(Traverse.prototype), function (key) { |
|
2071 traverse[key] = function (obj) { |
|
2072 var args = [].slice.call(arguments, 1); |
|
2073 var t = new Traverse(obj); |
|
2074 return t[key].apply(t, args); |
|
2075 }; |
|
2076 }); |
|
2077 |
|
2078 var hasOwnProperty = Object.hasOwnProperty || function (obj, key) { |
|
2079 return key in obj; |
|
2080 }; |
|
2081 |
|
2082 |
|
2083 /***/ }), |
|
2084 |
|
2085 /***/ 23: |
|
2086 /***/ (function(module, exports, __webpack_require__) { |
|
2087 |
|
2088 module.exports = __webpack_require__(54); |
|
2089 |
|
2090 |
|
2091 /***/ }), |
|
2092 |
|
2093 /***/ 25: |
|
2094 /***/ (function(module, exports) { |
|
2095 |
|
2096 (function() { module.exports = this["wp"]["url"]; }()); |
|
2097 |
|
2098 /***/ }), |
|
2099 |
|
2100 /***/ 26: |
|
2101 /***/ (function(module, exports) { |
|
2102 |
|
2103 (function() { module.exports = this["wp"]["hooks"]; }()); |
|
2104 |
|
2105 /***/ }), |
|
2106 |
|
2107 /***/ 27: |
|
2108 /***/ (function(module, exports) { |
|
2109 |
|
2110 (function() { module.exports = this["React"]; }()); |
|
2111 |
|
2112 /***/ }), |
|
2113 |
|
2114 /***/ 28: |
|
2115 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
2116 |
|
2117 "use strict"; |
|
2118 |
|
2119 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
2120 var arrayWithHoles = __webpack_require__(37); |
|
2121 |
|
2122 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
2123 function _iterableToArrayLimit(arr, i) { |
|
2124 var _arr = []; |
|
2125 var _n = true; |
|
2126 var _d = false; |
|
2127 var _e = undefined; |
|
2128 |
|
2129 try { |
|
2130 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
2131 _arr.push(_s.value); |
|
2132 |
|
2133 if (i && _arr.length === i) break; |
|
2134 } |
|
2135 } catch (err) { |
|
2136 _d = true; |
|
2137 _e = err; |
|
2138 } finally { |
|
2139 try { |
|
2140 if (!_n && _i["return"] != null) _i["return"](); |
|
2141 } finally { |
|
2142 if (_d) throw _e; |
|
2143 } |
|
2144 } |
|
2145 |
|
2146 return _arr; |
|
2147 } |
|
2148 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
2149 var nonIterableRest = __webpack_require__(38); |
|
2150 |
|
2151 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
2152 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); |
|
2153 |
|
2154 |
|
2155 |
|
2156 function _slicedToArray(arr, i) { |
|
2157 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
2158 } |
|
2159 |
|
2160 /***/ }), |
|
2161 |
|
2162 /***/ 3: |
|
2163 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
2164 |
|
2165 "use strict"; |
|
2166 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); |
|
2167 function _assertThisInitialized(self) { |
|
2168 if (self === void 0) { |
|
2169 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
|
2170 } |
|
2171 |
|
2172 return self; |
|
2173 } |
|
2174 |
|
2175 /***/ }), |
|
2176 |
|
2177 /***/ 30: |
|
2178 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1562 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2179 |
1563 |
2180 "use strict"; |
1564 "use strict"; |
2181 |
1565 |
2182 |
1566 |
2454 }); |
1838 }); |
2455 |
1839 |
2456 |
1840 |
2457 /***/ }), |
1841 /***/ }), |
2458 |
1842 |
2459 /***/ 31: |
1843 /***/ 421: |
2460 /***/ (function(module, exports, __webpack_require__) { |
|
2461 |
|
2462 /** |
|
2463 * Copyright (c) 2013-present, Facebook, Inc. |
|
2464 * |
|
2465 * This source code is licensed under the MIT license found in the |
|
2466 * LICENSE file in the root directory of this source tree. |
|
2467 */ |
|
2468 |
|
2469 if (false) { var throwOnDirectAccess, isValidElement, REACT_ELEMENT_TYPE; } else { |
|
2470 // By explicitly using `prop-types` you are opting into new production behavior. |
|
2471 // http://fb.me/prop-types-in-prod |
|
2472 module.exports = __webpack_require__(89)(); |
|
2473 } |
|
2474 |
|
2475 |
|
2476 /***/ }), |
|
2477 |
|
2478 /***/ 32: |
|
2479 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
2480 |
|
2481 "use strict"; |
|
2482 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
|
2483 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } |
|
2484 |
|
2485 function _typeof(obj) { |
|
2486 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { |
|
2487 _typeof = function _typeof(obj) { |
|
2488 return _typeof2(obj); |
|
2489 }; |
|
2490 } else { |
|
2491 _typeof = function _typeof(obj) { |
|
2492 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); |
|
2493 }; |
|
2494 } |
|
2495 |
|
2496 return _typeof(obj); |
|
2497 } |
|
2498 |
|
2499 /***/ }), |
|
2500 |
|
2501 /***/ 33: |
|
2502 /***/ (function(module, exports) { |
|
2503 |
|
2504 (function() { module.exports = this["wp"]["apiFetch"]; }()); |
|
2505 |
|
2506 /***/ }), |
|
2507 |
|
2508 /***/ 34: |
|
2509 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
2510 |
|
2511 "use strict"; |
|
2512 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
2513 function _iterableToArray(iter) { |
|
2514 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); |
|
2515 } |
|
2516 |
|
2517 /***/ }), |
|
2518 |
|
2519 /***/ 341: |
|
2520 /***/ (function(module, exports, __webpack_require__) { |
1844 /***/ (function(module, exports, __webpack_require__) { |
2521 |
1845 |
2522 "use strict"; |
1846 "use strict"; |
2523 |
1847 |
2524 |
1848 |
2680 } |
2004 } |
2681 } |
2005 } |
2682 |
2006 |
2683 /***/ }), |
2007 /***/ }), |
2684 |
2008 |
2685 /***/ 35: |
2009 /***/ 438: |
2686 /***/ (function(module, exports) { |
|
2687 |
|
2688 (function() { module.exports = this["wp"]["blob"]; }()); |
|
2689 |
|
2690 /***/ }), |
|
2691 |
|
2692 /***/ 358: |
|
2693 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2010 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2694 |
2011 |
2695 "use strict"; |
2012 "use strict"; |
2013 // ESM COMPAT FLAG |
|
2696 __webpack_require__.r(__webpack_exports__); |
2014 __webpack_require__.r(__webpack_exports__); |
2015 |
|
2016 // EXPORTS |
|
2017 __webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return /* reexport */ autocompleters_user; }); |
|
2018 __webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return /* reexport */ autosave_monitor; }); |
|
2019 __webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return /* reexport */ document_outline; }); |
|
2020 __webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return /* reexport */ check; }); |
|
2021 __webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return /* reexport */ visual_editor_shortcuts; }); |
|
2022 __webpack_require__.d(__webpack_exports__, "EditorGlobalKeyboardShortcuts", function() { return /* reexport */ EditorGlobalKeyboardShortcuts; }); |
|
2023 __webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; }); |
|
2024 __webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", function() { return /* reexport */ register_shortcuts; }); |
|
2025 __webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; }); |
|
2026 __webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; }); |
|
2027 __webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; }); |
|
2028 __webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; }); |
|
2029 __webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; }); |
|
2030 __webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; }); |
|
2031 __webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return /* reexport */ page_attributes_check; }); |
|
2032 __webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return /* reexport */ page_attributes_order; }); |
|
2033 __webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return /* reexport */ page_attributes_parent; }); |
|
2034 __webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return /* reexport */ page_attributes_template; }); |
|
2035 __webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return /* reexport */ post_author; }); |
|
2036 __webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return /* reexport */ post_author_check; }); |
|
2037 __webpack_require__.d(__webpack_exports__, "PostComments", function() { return /* reexport */ post_comments; }); |
|
2038 __webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return /* reexport */ post_excerpt; }); |
|
2039 __webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return /* reexport */ post_excerpt_check; }); |
|
2040 __webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return /* reexport */ post_featured_image; }); |
|
2041 __webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return /* reexport */ post_featured_image_check; }); |
|
2042 __webpack_require__.d(__webpack_exports__, "PostFormat", function() { return /* reexport */ post_format; }); |
|
2043 __webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return /* reexport */ post_format_check; }); |
|
2044 __webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return /* reexport */ post_last_revision; }); |
|
2045 __webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return /* reexport */ post_last_revision_check; }); |
|
2046 __webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return /* reexport */ post_locked_modal; }); |
|
2047 __webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return /* reexport */ post_pending_status; }); |
|
2048 __webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return /* reexport */ post_pending_status_check; }); |
|
2049 __webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return /* reexport */ post_pingbacks; }); |
|
2050 __webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return /* reexport */ post_preview_button; }); |
|
2051 __webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return /* reexport */ post_publish_button; }); |
|
2052 __webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return /* reexport */ post_publish_button_label; }); |
|
2053 __webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return /* reexport */ post_publish_panel; }); |
|
2054 __webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return /* reexport */ post_saved_state; }); |
|
2055 __webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return /* reexport */ post_schedule; }); |
|
2056 __webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return /* reexport */ post_schedule_check; }); |
|
2057 __webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return /* reexport */ post_schedule_label; }); |
|
2058 __webpack_require__.d(__webpack_exports__, "PostSlug", function() { return /* reexport */ post_slug; }); |
|
2059 __webpack_require__.d(__webpack_exports__, "PostSlugCheck", function() { return /* reexport */ PostSlugCheck; }); |
|
2060 __webpack_require__.d(__webpack_exports__, "PostSticky", function() { return /* reexport */ post_sticky; }); |
|
2061 __webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return /* reexport */ post_sticky_check; }); |
|
2062 __webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return /* reexport */ post_switch_to_draft_button; }); |
|
2063 __webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return /* reexport */ post_taxonomies; }); |
|
2064 __webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return /* reexport */ post_taxonomies_check; }); |
|
2065 __webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return /* reexport */ post_text_editor; }); |
|
2066 __webpack_require__.d(__webpack_exports__, "PostTitle", function() { return /* reexport */ post_title; }); |
|
2067 __webpack_require__.d(__webpack_exports__, "PostTrash", function() { return /* reexport */ post_trash; }); |
|
2068 __webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return /* reexport */ post_trash_check; }); |
|
2069 __webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return /* reexport */ post_type_support_check; }); |
|
2070 __webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return /* reexport */ post_visibility; }); |
|
2071 __webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return /* reexport */ post_visibility_label; }); |
|
2072 __webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return /* reexport */ post_visibility_check; }); |
|
2073 __webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return /* reexport */ table_of_contents; }); |
|
2074 __webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return /* reexport */ unsaved_changes_warning; }); |
|
2075 __webpack_require__.d(__webpack_exports__, "WordCount", function() { return /* reexport */ word_count; }); |
|
2076 __webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return /* reexport */ provider; }); |
|
2077 __webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return /* reexport */ external_this_wp_serverSideRender_default.a; }); |
|
2078 __webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ RichText; }); |
|
2079 __webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; }); |
|
2080 __webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; }); |
|
2081 __webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; }); |
|
2082 __webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ BlockControls; }); |
|
2083 __webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ deprecated_BlockEdit; }); |
|
2084 __webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ BlockEditorKeyboardShortcuts; }); |
|
2085 __webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; }); |
|
2086 __webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; }); |
|
2087 __webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ BlockInspector; }); |
|
2088 __webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; }); |
|
2089 __webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ BlockMover; }); |
|
2090 __webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ BlockNavigationDropdown; }); |
|
2091 __webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; }); |
|
2092 __webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ BlockSettingsMenu; }); |
|
2093 __webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; }); |
|
2094 __webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; }); |
|
2095 __webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; }); |
|
2096 __webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ ContrastChecker; }); |
|
2097 __webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ CopyHandler; }); |
|
2098 __webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ DefaultBlockAppender; }); |
|
2099 __webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ FontSizePicker; }); |
|
2100 __webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ Inserter; }); |
|
2101 __webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ InnerBlocks; }); |
|
2102 __webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ InspectorAdvancedControls; }); |
|
2103 __webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ InspectorControls; }); |
|
2104 __webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ PanelColorSettings; }); |
|
2105 __webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ PlainText; }); |
|
2106 __webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; }); |
|
2107 __webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; }); |
|
2108 __webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ __unstableRichTextInputEvent; }); |
|
2109 __webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ MediaPlaceholder; }); |
|
2110 __webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ MediaUpload; }); |
|
2111 __webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ MediaUploadCheck; }); |
|
2112 __webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; }); |
|
2113 __webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ NavigableToolbar; }); |
|
2114 __webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ ObserveTyping; }); |
|
2115 __webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; }); |
|
2116 __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ SkipToSelectedBlock; }); |
|
2117 __webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ URLInput; }); |
|
2118 __webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ URLInputButton; }); |
|
2119 __webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ URLPopover; }); |
|
2120 __webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ Warning; }); |
|
2121 __webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; }); |
|
2122 __webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; }); |
|
2123 __webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; }); |
|
2124 __webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; }); |
|
2125 __webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; }); |
|
2126 __webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; }); |
|
2127 __webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; }); |
|
2128 __webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ withColorContext; }); |
|
2129 __webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; }); |
|
2130 __webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ withFontSizes; }); |
|
2131 __webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return /* reexport */ mediaUpload; }); |
|
2132 __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; }); |
|
2133 __webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; }); |
|
2134 __webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ external_this_wp_blockEditor_["transformStyles"]; }); |
|
2135 |
|
2136 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js |
|
2697 var actions_namespaceObject = {}; |
2137 var actions_namespaceObject = {}; |
2698 __webpack_require__.r(actions_namespaceObject); |
2138 __webpack_require__.r(actions_namespaceObject); |
2699 __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return setupEditor; }); |
2139 __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return setupEditor; }); |
2140 __webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return __experimentalTearDownEditor; }); |
|
2700 __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; }); |
2141 __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; }); |
2701 __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; }); |
2142 __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; }); |
2702 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; }); |
2143 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; }); |
2703 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateSuccess", function() { return __experimentalRequestPostUpdateSuccess; }); |
2144 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; }); |
2704 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFailure", function() { return __experimentalRequestPostUpdateFailure; }); |
|
2705 __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; }); |
2145 __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; }); |
2706 __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; }); |
2146 __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; }); |
2707 __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; }); |
2147 __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; }); |
2708 __webpack_require__.d(actions_namespaceObject, "__experimentalOptimisticUpdatePost", function() { return __experimentalOptimisticUpdatePost; }); |
2148 __webpack_require__.d(actions_namespaceObject, "__experimentalOptimisticUpdatePost", function() { return __experimentalOptimisticUpdatePost; }); |
2709 __webpack_require__.d(actions_namespaceObject, "savePost", function() { return savePost; }); |
2149 __webpack_require__.d(actions_namespaceObject, "savePost", function() { return actions_savePost; }); |
2710 __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; }); |
2150 __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; }); |
2711 __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; }); |
2151 __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; }); |
2712 __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; }); |
2152 __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; }); |
2153 __webpack_require__.d(actions_namespaceObject, "__experimentalLocalAutosave", function() { return actions_experimentalLocalAutosave; }); |
|
2713 __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; }); |
2154 __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; }); |
2714 __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; }); |
2155 __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; }); |
2715 __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; }); |
2156 __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; }); |
2716 __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return updatePostLock; }); |
2157 __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return updatePostLock; }); |
2717 __webpack_require__.d(actions_namespaceObject, "__experimentalFetchReusableBlocks", function() { return __experimentalFetchReusableBlocks; }); |
2158 __webpack_require__.d(actions_namespaceObject, "__experimentalFetchReusableBlocks", function() { return actions_experimentalFetchReusableBlocks; }); |
2718 __webpack_require__.d(actions_namespaceObject, "__experimentalReceiveReusableBlocks", function() { return __experimentalReceiveReusableBlocks; }); |
2159 __webpack_require__.d(actions_namespaceObject, "__experimentalReceiveReusableBlocks", function() { return __experimentalReceiveReusableBlocks; }); |
2719 __webpack_require__.d(actions_namespaceObject, "__experimentalSaveReusableBlock", function() { return __experimentalSaveReusableBlock; }); |
2160 __webpack_require__.d(actions_namespaceObject, "__experimentalSaveReusableBlock", function() { return __experimentalSaveReusableBlock; }); |
2720 __webpack_require__.d(actions_namespaceObject, "__experimentalDeleteReusableBlock", function() { return __experimentalDeleteReusableBlock; }); |
2161 __webpack_require__.d(actions_namespaceObject, "__experimentalDeleteReusableBlock", function() { return __experimentalDeleteReusableBlock; }); |
2721 __webpack_require__.d(actions_namespaceObject, "__experimentalUpdateReusableBlockTitle", function() { return __experimentalUpdateReusableBlockTitle; }); |
2162 __webpack_require__.d(actions_namespaceObject, "__experimentalUpdateReusableBlock", function() { return __experimentalUpdateReusableBlock; }); |
2722 __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToStatic", function() { return __experimentalConvertBlockToStatic; }); |
2163 __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToStatic", function() { return __experimentalConvertBlockToStatic; }); |
2723 __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToReusable", function() { return __experimentalConvertBlockToReusable; }); |
2164 __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToReusable", function() { return __experimentalConvertBlockToReusable; }); |
2724 __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; }); |
2165 __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; }); |
2725 __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; }); |
2166 __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; }); |
2726 __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; }); |
2167 __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; }); |
2727 __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; }); |
2168 __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; }); |
2169 __webpack_require__.d(actions_namespaceObject, "lockPostAutosaving", function() { return lockPostAutosaving; }); |
|
2170 __webpack_require__.d(actions_namespaceObject, "unlockPostAutosaving", function() { return unlockPostAutosaving; }); |
|
2728 __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; }); |
2171 __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; }); |
2729 __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return updateEditorSettings; }); |
2172 __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return updateEditorSettings; }); |
2730 __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; }); |
2173 __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; }); |
2731 __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); |
2174 __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); |
2732 __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; }); |
2175 __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; }); |
2733 __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; }); |
2176 __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; }); |
2734 __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return selectBlock; }); |
2177 __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; }); |
2735 __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; }); |
2178 __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; }); |
2736 __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; }); |
2179 __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; }); |
2737 __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; }); |
2180 __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; }); |
2738 __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return clearSelectedBlock; }); |
2181 __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return clearSelectedBlock; }); |
2739 __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; }); |
2182 __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; }); |
2740 __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; }); |
2183 __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return actions_replaceBlocks; }); |
2741 __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; }); |
2184 __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; }); |
2742 __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; }); |
2185 __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; }); |
2743 __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; }); |
2186 __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; }); |
2744 __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; }); |
2187 __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; }); |
2745 __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; }); |
2188 __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; }); |
2756 __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; }); |
2199 __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; }); |
2757 __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; }); |
2200 __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; }); |
2758 __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; }); |
2201 __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; }); |
2759 __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return insertDefaultBlock; }); |
2202 __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return insertDefaultBlock; }); |
2760 __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; }); |
2203 __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; }); |
2204 |
|
2205 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
|
2761 var selectors_namespaceObject = {}; |
2206 var selectors_namespaceObject = {}; |
2762 __webpack_require__.r(selectors_namespaceObject); |
2207 __webpack_require__.r(selectors_namespaceObject); |
2763 __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; }); |
2208 __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; }); |
2764 __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; }); |
2209 __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; }); |
2765 __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; }); |
2210 __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return isEditedPostNew; }); |
2766 __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; }); |
2211 __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; }); |
2767 __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; }); |
2212 __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; }); |
2213 __webpack_require__.d(selectors_namespaceObject, "hasNonPostEntityChanges", function() { return selectors_hasNonPostEntityChanges; }); |
|
2768 __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; }); |
2214 __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; }); |
2769 __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; }); |
2215 __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; }); |
2770 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; }); |
2216 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; }); |
2771 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; }); |
2217 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; }); |
2772 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; }); |
2218 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; }); |
2773 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; }); |
2219 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; }); |
2774 __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return getPostEdits; }); |
2220 __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return selectors_getPostEdits; }); |
2775 __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; }); |
2221 __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; }); |
2776 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; }); |
2222 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; }); |
2777 __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; }); |
2223 __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; }); |
2778 __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; }); |
2224 __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; }); |
2779 __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; }); |
2225 __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; }); |
2798 __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; }); |
2244 __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; }); |
2799 __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; }); |
2245 __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; }); |
2800 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlock", function() { return __experimentalGetReusableBlock; }); |
2246 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlock", function() { return __experimentalGetReusableBlock; }); |
2801 __webpack_require__.d(selectors_namespaceObject, "__experimentalIsSavingReusableBlock", function() { return __experimentalIsSavingReusableBlock; }); |
2247 __webpack_require__.d(selectors_namespaceObject, "__experimentalIsSavingReusableBlock", function() { return __experimentalIsSavingReusableBlock; }); |
2802 __webpack_require__.d(selectors_namespaceObject, "__experimentalIsFetchingReusableBlock", function() { return __experimentalIsFetchingReusableBlock; }); |
2248 __webpack_require__.d(selectors_namespaceObject, "__experimentalIsFetchingReusableBlock", function() { return __experimentalIsFetchingReusableBlock; }); |
2803 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlocks", function() { return __experimentalGetReusableBlocks; }); |
2249 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlocks", function() { return selectors_experimentalGetReusableBlocks; }); |
2804 __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; }); |
2250 __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; }); |
2805 __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; }); |
2251 __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; }); |
2806 __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return selectors_isPermalinkEditable; }); |
2252 __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return isPermalinkEditable; }); |
2807 __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; }); |
2253 __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; }); |
2808 __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return selectors_getPermalinkParts; }); |
2254 __webpack_require__.d(selectors_namespaceObject, "getEditedPostSlug", function() { return getEditedPostSlug; }); |
2255 __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return getPermalinkParts; }); |
|
2809 __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; }); |
2256 __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; }); |
2810 __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return isPostLocked; }); |
2257 __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return isPostLocked; }); |
2811 __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; }); |
2258 __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; }); |
2259 __webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; }); |
|
2812 __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; }); |
2260 __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; }); |
2813 __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; }); |
2261 __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; }); |
2814 __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; }); |
2262 __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; }); |
2815 __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return canUserUseUnfilteredHTML; }); |
2263 __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; }); |
2816 __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; }); |
2264 __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; }); |
2817 __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return getEditorBlocks; }); |
2265 __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return selectors_getEditorBlocks; }); |
2266 __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionStart", function() { return selectors_getEditorSelectionStart; }); |
|
2267 __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionEnd", function() { return selectors_getEditorSelectionEnd; }); |
|
2818 __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return __unstableIsEditorReady; }); |
2268 __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return __unstableIsEditorReady; }); |
2819 __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; }); |
2269 __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; }); |
2820 __webpack_require__.d(selectors_namespaceObject, "getBlockDependantsCacheBust", function() { return getBlockDependantsCacheBust; }); |
2270 __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; }); |
2821 __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return selectors_getBlockName; }); |
|
2822 __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; }); |
2271 __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; }); |
2823 __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; }); |
2272 __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; }); |
2824 __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; }); |
2273 __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return selectors_getBlock; }); |
2825 __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); |
2274 __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); |
2826 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; }); |
2275 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; }); |
2827 __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; }); |
2276 __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; }); |
2828 __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; }); |
2277 __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; }); |
2829 __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return getGlobalBlockCount; }); |
2278 __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return getGlobalBlockCount; }); |
2830 __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; }); |
2279 __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return selectors_getBlocksByClientId; }); |
2831 __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; }); |
2280 __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; }); |
2832 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; }); |
2281 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; }); |
2833 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; }); |
2282 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; }); |
2834 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; }); |
2283 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; }); |
2835 __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; }); |
2284 __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; }); |
2836 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return selectors_getSelectedBlockClientId; }); |
2285 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; }); |
2837 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; }); |
2286 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; }); |
2838 __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; }); |
2287 __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; }); |
2839 __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; }); |
2288 __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; }); |
2840 __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); |
2289 __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); |
2841 __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; }); |
2290 __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; }); |
2857 __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; }); |
2306 __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; }); |
2858 __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; }); |
2307 __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; }); |
2859 __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; }); |
2308 __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; }); |
2860 __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; }); |
2309 __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; }); |
2861 __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; }); |
2310 __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; }); |
2862 __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return selectors_isTyping; }); |
2311 __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; }); |
2863 __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return selectors_isCaretWithinFormattedText; }); |
2312 __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; }); |
2864 __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; }); |
2313 __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; }); |
2865 __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; }); |
2314 __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; }); |
2866 __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; }); |
2315 __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; }); |
2867 __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; }); |
2316 __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; }); |
2868 __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; }); |
2317 __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; }); |
2869 __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; }); |
2318 __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return selectors_canInsertBlockType; }); |
2870 __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; }); |
2319 __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; }); |
2871 __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; }); |
2320 __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; }); |
2872 __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; }); |
2321 __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; }); |
2873 |
2322 |
2874 // EXTERNAL MODULE: external {"this":["wp","blockEditor"]} |
2323 // EXTERNAL MODULE: external {"this":["wp","blockEditor"]} |
2875 var external_this_wp_blockEditor_ = __webpack_require__(8); |
2324 var external_this_wp_blockEditor_ = __webpack_require__(7); |
2876 |
2325 |
2877 // EXTERNAL MODULE: external {"this":["wp","blocks"]} |
2326 // EXTERNAL MODULE: external {"this":["wp","blocks"]} |
2878 var external_this_wp_blocks_ = __webpack_require__(14); |
2327 var external_this_wp_blocks_ = __webpack_require__(10); |
2879 |
2328 |
2880 // EXTERNAL MODULE: external {"this":["wp","coreData"]} |
2329 // EXTERNAL MODULE: external {"this":["wp","coreData"]} |
2881 var external_this_wp_coreData_ = __webpack_require__(72); |
2330 var external_this_wp_coreData_ = __webpack_require__(98); |
2331 |
|
2332 // EXTERNAL MODULE: external {"this":["wp","keyboardShortcuts"]} |
|
2333 var external_this_wp_keyboardShortcuts_ = __webpack_require__(52); |
|
2882 |
2334 |
2883 // EXTERNAL MODULE: external {"this":["wp","notices"]} |
2335 // EXTERNAL MODULE: external {"this":["wp","notices"]} |
2884 var external_this_wp_notices_ = __webpack_require__(133); |
2336 var external_this_wp_notices_ = __webpack_require__(100); |
2885 |
|
2886 // EXTERNAL MODULE: external {"this":["wp","nux"]} |
|
2887 var external_this_wp_nux_ = __webpack_require__(60); |
|
2888 |
2337 |
2889 // EXTERNAL MODULE: external {"this":["wp","richText"]} |
2338 // EXTERNAL MODULE: external {"this":["wp","richText"]} |
2890 var external_this_wp_richText_ = __webpack_require__(20); |
2339 var external_this_wp_richText_ = __webpack_require__(25); |
2891 |
2340 |
2892 // EXTERNAL MODULE: external {"this":["wp","viewport"]} |
2341 // EXTERNAL MODULE: external {"this":["wp","viewport"]} |
2893 var external_this_wp_viewport_ = __webpack_require__(40); |
2342 var external_this_wp_viewport_ = __webpack_require__(81); |
2343 |
|
2344 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
2345 var defineProperty = __webpack_require__(5); |
|
2894 |
2346 |
2895 // EXTERNAL MODULE: external {"this":["wp","data"]} |
2347 // EXTERNAL MODULE: external {"this":["wp","data"]} |
2896 var external_this_wp_data_ = __webpack_require__(5); |
2348 var external_this_wp_data_ = __webpack_require__(4); |
2897 |
2349 |
2898 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
2350 // EXTERNAL MODULE: external {"this":["wp","dataControls"]} |
2899 var slicedToArray = __webpack_require__(28); |
2351 var external_this_wp_dataControls_ = __webpack_require__(36); |
2900 |
|
2901 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
2902 var defineProperty = __webpack_require__(15); |
|
2903 |
|
2904 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
2905 var objectSpread = __webpack_require__(7); |
|
2906 |
2352 |
2907 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js |
2353 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js |
2908 var esm_typeof = __webpack_require__(32); |
2354 var esm_typeof = __webpack_require__(40); |
2909 |
2355 |
2910 // EXTERNAL MODULE: ./node_modules/redux-optimist/index.js |
2356 // EXTERNAL MODULE: ./node_modules/redux-optimist/index.js |
2911 var redux_optimist = __webpack_require__(62); |
2357 var redux_optimist = __webpack_require__(134); |
2912 var redux_optimist_default = /*#__PURE__*/__webpack_require__.n(redux_optimist); |
2358 var redux_optimist_default = /*#__PURE__*/__webpack_require__.n(redux_optimist); |
2913 |
2359 |
2914 // EXTERNAL MODULE: external "lodash" |
2360 // EXTERNAL MODULE: external {"this":"lodash"} |
2915 var external_lodash_ = __webpack_require__(2); |
2361 var external_this_lodash_ = __webpack_require__(2); |
2916 |
|
2917 // EXTERNAL MODULE: external {"this":["wp","url"]} |
|
2918 var external_this_wp_url_ = __webpack_require__(25); |
|
2919 |
2362 |
2920 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js |
2363 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js |
2921 |
2364 |
2922 |
2365 |
2366 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
2367 |
|
2368 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
2369 |
|
2923 /** |
2370 /** |
2924 * WordPress dependencies |
2371 * WordPress dependencies |
2925 */ |
2372 */ |
2926 |
2373 |
2927 var PREFERENCES_DEFAULTS = { |
2374 var PREFERENCES_DEFAULTS = { |
2375 insertUsage: {}, |
|
2376 // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580. |
|
2928 isPublishSidebarEnabled: true |
2377 isPublishSidebarEnabled: true |
2929 }; |
2378 }; |
2930 /** |
2379 /** |
2931 * Default initial edits state. |
|
2932 * |
|
2933 * @type {Object} |
|
2934 */ |
|
2935 |
|
2936 var INITIAL_EDITS_DEFAULTS = {}; |
|
2937 /** |
|
2938 * The default post editor settings |
2380 * The default post editor settings |
2939 * |
2381 * |
2940 * allowedBlockTypes boolean|Array Allowed block types |
2382 * allowedBlockTypes boolean|Array Allowed block types |
2941 * richEditingEnabled boolean Whether rich editing is enabled or not |
2383 * richEditingEnabled boolean Whether rich editing is enabled or not |
2384 * codeEditingEnabled boolean Whether code editing is enabled or not |
|
2942 * enableCustomFields boolean Whether the WordPress custom fields are enabled or not |
2385 * enableCustomFields boolean Whether the WordPress custom fields are enabled or not |
2943 * autosaveInterval number Autosave Interval |
2386 * autosaveInterval number Autosave Interval |
2944 * availableTemplates array? The available post templates |
2387 * availableTemplates array? The available post templates |
2945 * disablePostFormats boolean Whether or not the post formats are disabled |
2388 * disablePostFormats boolean Whether or not the post formats are disabled |
2946 * allowedMimeTypes array? List of allowed mime types and file extensions |
2389 * allowedMimeTypes array? List of allowed mime types and file extensions |
2947 * maxUploadFileSize number Maximum upload file size |
2390 * maxUploadFileSize number Maximum upload file size |
2948 */ |
2391 */ |
2949 |
2392 |
2950 var EDITOR_SETTINGS_DEFAULTS = Object(objectSpread["a" /* default */])({}, external_this_wp_blockEditor_["SETTINGS_DEFAULTS"], { |
2393 var EDITOR_SETTINGS_DEFAULTS = _objectSpread({}, external_this_wp_blockEditor_["SETTINGS_DEFAULTS"], { |
2951 richEditingEnabled: true, |
2394 richEditingEnabled: true, |
2395 codeEditingEnabled: true, |
|
2952 enableCustomFields: false |
2396 enableCustomFields: false |
2953 }); |
2397 }); |
2954 |
2398 |
2399 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js |
|
2400 |
|
2401 |
|
2402 |
|
2403 function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
2404 |
|
2405 function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
2406 |
|
2407 /** |
|
2408 * External dependencies |
|
2409 */ |
|
2410 |
|
2411 |
|
2412 /** |
|
2413 * WordPress dependencies |
|
2414 */ |
|
2415 |
|
2416 |
|
2417 /** |
|
2418 * Internal dependencies |
|
2419 */ |
|
2420 |
|
2421 |
|
2422 /** |
|
2423 * Returns a post attribute value, flattening nested rendered content using its |
|
2424 * raw value in place of its original object form. |
|
2425 * |
|
2426 * @param {*} value Original value. |
|
2427 * |
|
2428 * @return {*} Raw value. |
|
2429 */ |
|
2430 |
|
2431 function getPostRawValue(value) { |
|
2432 if (value && 'object' === Object(esm_typeof["a" /* default */])(value) && 'raw' in value) { |
|
2433 return value.raw; |
|
2434 } |
|
2435 |
|
2436 return value; |
|
2437 } |
|
2438 /** |
|
2439 * Returns true if the two object arguments have the same keys, or false |
|
2440 * otherwise. |
|
2441 * |
|
2442 * @param {Object} a First object. |
|
2443 * @param {Object} b Second object. |
|
2444 * |
|
2445 * @return {boolean} Whether the two objects have the same keys. |
|
2446 */ |
|
2447 |
|
2448 function hasSameKeys(a, b) { |
|
2449 return Object(external_this_lodash_["isEqual"])(Object(external_this_lodash_["keys"])(a), Object(external_this_lodash_["keys"])(b)); |
|
2450 } |
|
2451 /** |
|
2452 * Returns true if, given the currently dispatching action and the previously |
|
2453 * dispatched action, the two actions are editing the same post property, or |
|
2454 * false otherwise. |
|
2455 * |
|
2456 * @param {Object} action Currently dispatching action. |
|
2457 * @param {Object} previousAction Previously dispatched action. |
|
2458 * |
|
2459 * @return {boolean} Whether actions are updating the same post property. |
|
2460 */ |
|
2461 |
|
2462 function isUpdatingSamePostProperty(action, previousAction) { |
|
2463 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); |
|
2464 } |
|
2465 /** |
|
2466 * Returns true if, given the currently dispatching action and the previously |
|
2467 * dispatched action, the two actions are modifying the same property such that |
|
2468 * undo history should be batched. |
|
2469 * |
|
2470 * @param {Object} action Currently dispatching action. |
|
2471 * @param {Object} previousAction Previously dispatched action. |
|
2472 * |
|
2473 * @return {boolean} Whether to overwrite present state. |
|
2474 */ |
|
2475 |
|
2476 function shouldOverwriteState(action, previousAction) { |
|
2477 if (action.type === 'RESET_EDITOR_BLOCKS') { |
|
2478 return !action.shouldCreateUndoLevel; |
|
2479 } |
|
2480 |
|
2481 if (!previousAction || action.type !== previousAction.type) { |
|
2482 return false; |
|
2483 } |
|
2484 |
|
2485 return isUpdatingSamePostProperty(action, previousAction); |
|
2486 } |
|
2487 function reducer_postId() { |
|
2488 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
2489 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2490 |
|
2491 switch (action.type) { |
|
2492 case 'SETUP_EDITOR_STATE': |
|
2493 case 'RESET_POST': |
|
2494 case 'UPDATE_POST': |
|
2495 return action.post.id; |
|
2496 } |
|
2497 |
|
2498 return state; |
|
2499 } |
|
2500 function reducer_postType() { |
|
2501 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
2502 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2503 |
|
2504 switch (action.type) { |
|
2505 case 'SETUP_EDITOR_STATE': |
|
2506 case 'RESET_POST': |
|
2507 case 'UPDATE_POST': |
|
2508 return action.post.type; |
|
2509 } |
|
2510 |
|
2511 return state; |
|
2512 } |
|
2513 /** |
|
2514 * Reducer returning whether the post blocks match the defined template or not. |
|
2515 * |
|
2516 * @param {Object} state Current state. |
|
2517 * @param {Object} action Dispatched action. |
|
2518 * |
|
2519 * @return {boolean} Updated state. |
|
2520 */ |
|
2521 |
|
2522 function reducer_template() { |
|
2523 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
2524 isValid: true |
|
2525 }; |
|
2526 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2527 |
|
2528 switch (action.type) { |
|
2529 case 'SET_TEMPLATE_VALIDITY': |
|
2530 return reducer_objectSpread({}, state, { |
|
2531 isValid: action.isValid |
|
2532 }); |
|
2533 } |
|
2534 |
|
2535 return state; |
|
2536 } |
|
2537 /** |
|
2538 * Reducer returning the user preferences. |
|
2539 * |
|
2540 * @param {Object} state Current state. |
|
2541 * @param {Object} action Dispatched action. |
|
2542 * |
|
2543 * @return {string} Updated state. |
|
2544 */ |
|
2545 |
|
2546 function preferences() { |
|
2547 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS; |
|
2548 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2549 |
|
2550 switch (action.type) { |
|
2551 case 'ENABLE_PUBLISH_SIDEBAR': |
|
2552 return reducer_objectSpread({}, state, { |
|
2553 isPublishSidebarEnabled: true |
|
2554 }); |
|
2555 |
|
2556 case 'DISABLE_PUBLISH_SIDEBAR': |
|
2557 return reducer_objectSpread({}, state, { |
|
2558 isPublishSidebarEnabled: false |
|
2559 }); |
|
2560 } |
|
2561 |
|
2562 return state; |
|
2563 } |
|
2564 /** |
|
2565 * Reducer returning current network request state (whether a request to |
|
2566 * the WP REST API is in progress, successful, or failed). |
|
2567 * |
|
2568 * @param {Object} state Current state. |
|
2569 * @param {Object} action Dispatched action. |
|
2570 * |
|
2571 * @return {Object} Updated state. |
|
2572 */ |
|
2573 |
|
2574 function saving() { |
|
2575 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2576 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2577 |
|
2578 switch (action.type) { |
|
2579 case 'REQUEST_POST_UPDATE_START': |
|
2580 case 'REQUEST_POST_UPDATE_FINISH': |
|
2581 return { |
|
2582 pending: action.type === 'REQUEST_POST_UPDATE_START', |
|
2583 options: action.options || {} |
|
2584 }; |
|
2585 } |
|
2586 |
|
2587 return state; |
|
2588 } |
|
2589 /** |
|
2590 * Post Lock State. |
|
2591 * |
|
2592 * @typedef {Object} PostLockState |
|
2593 * |
|
2594 * @property {boolean} isLocked Whether the post is locked. |
|
2595 * @property {?boolean} isTakeover Whether the post editing has been taken over. |
|
2596 * @property {?boolean} activePostLock Active post lock value. |
|
2597 * @property {?Object} user User that took over the post. |
|
2598 */ |
|
2599 |
|
2600 /** |
|
2601 * Reducer returning the post lock status. |
|
2602 * |
|
2603 * @param {PostLockState} state Current state. |
|
2604 * @param {Object} action Dispatched action. |
|
2605 * |
|
2606 * @return {PostLockState} Updated state. |
|
2607 */ |
|
2608 |
|
2609 function postLock() { |
|
2610 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
2611 isLocked: false |
|
2612 }; |
|
2613 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2614 |
|
2615 switch (action.type) { |
|
2616 case 'UPDATE_POST_LOCK': |
|
2617 return action.lock; |
|
2618 } |
|
2619 |
|
2620 return state; |
|
2621 } |
|
2622 /** |
|
2623 * Post saving lock. |
|
2624 * |
|
2625 * When post saving is locked, the post cannot be published or updated. |
|
2626 * |
|
2627 * @param {PostLockState} state Current state. |
|
2628 * @param {Object} action Dispatched action. |
|
2629 * |
|
2630 * @return {PostLockState} Updated state. |
|
2631 */ |
|
2632 |
|
2633 function postSavingLock() { |
|
2634 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2635 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2636 |
|
2637 switch (action.type) { |
|
2638 case 'LOCK_POST_SAVING': |
|
2639 return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); |
|
2640 |
|
2641 case 'UNLOCK_POST_SAVING': |
|
2642 return Object(external_this_lodash_["omit"])(state, action.lockName); |
|
2643 } |
|
2644 |
|
2645 return state; |
|
2646 } |
|
2647 /** |
|
2648 * Post autosaving lock. |
|
2649 * |
|
2650 * When post autosaving is locked, the post will not autosave. |
|
2651 * |
|
2652 * @param {PostLockState} state Current state. |
|
2653 * @param {Object} action Dispatched action. |
|
2654 * |
|
2655 * @return {PostLockState} Updated state. |
|
2656 */ |
|
2657 |
|
2658 function postAutosavingLock() { |
|
2659 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2660 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2661 |
|
2662 switch (action.type) { |
|
2663 case 'LOCK_POST_AUTOSAVING': |
|
2664 return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); |
|
2665 |
|
2666 case 'UNLOCK_POST_AUTOSAVING': |
|
2667 return Object(external_this_lodash_["omit"])(state, action.lockName); |
|
2668 } |
|
2669 |
|
2670 return state; |
|
2671 } |
|
2672 var reducer_reusableBlocks = Object(external_this_wp_data_["combineReducers"])({ |
|
2673 data: function data() { |
|
2674 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2675 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2676 |
|
2677 switch (action.type) { |
|
2678 case 'RECEIVE_REUSABLE_BLOCKS': |
|
2679 { |
|
2680 return reducer_objectSpread({}, state, {}, Object(external_this_lodash_["keyBy"])(action.results, 'id')); |
|
2681 } |
|
2682 |
|
2683 case 'UPDATE_REUSABLE_BLOCK': |
|
2684 { |
|
2685 var id = action.id, |
|
2686 changes = action.changes; |
|
2687 return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, id, reducer_objectSpread({}, state[id], {}, changes))); |
|
2688 } |
|
2689 |
|
2690 case 'SAVE_REUSABLE_BLOCK_SUCCESS': |
|
2691 { |
|
2692 var _id = action.id, |
|
2693 updatedId = action.updatedId; // If a temporary reusable block is saved, we swap the temporary id with the final one |
|
2694 |
|
2695 if (_id === updatedId) { |
|
2696 return state; |
|
2697 } |
|
2698 |
|
2699 var value = state[_id]; |
|
2700 return reducer_objectSpread({}, Object(external_this_lodash_["omit"])(state, _id), Object(defineProperty["a" /* default */])({}, updatedId, reducer_objectSpread({}, value, { |
|
2701 id: updatedId |
|
2702 }))); |
|
2703 } |
|
2704 |
|
2705 case 'REMOVE_REUSABLE_BLOCK': |
|
2706 { |
|
2707 var _id2 = action.id; |
|
2708 return Object(external_this_lodash_["omit"])(state, _id2); |
|
2709 } |
|
2710 } |
|
2711 |
|
2712 return state; |
|
2713 }, |
|
2714 isFetching: function isFetching() { |
|
2715 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2716 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2717 |
|
2718 switch (action.type) { |
|
2719 case 'FETCH_REUSABLE_BLOCKS': |
|
2720 { |
|
2721 var id = action.id; |
|
2722 |
|
2723 if (!id) { |
|
2724 return state; |
|
2725 } |
|
2726 |
|
2727 return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, id, true)); |
|
2728 } |
|
2729 |
|
2730 case 'FETCH_REUSABLE_BLOCKS_SUCCESS': |
|
2731 case 'FETCH_REUSABLE_BLOCKS_FAILURE': |
|
2732 { |
|
2733 var _id3 = action.id; |
|
2734 return Object(external_this_lodash_["omit"])(state, _id3); |
|
2735 } |
|
2736 } |
|
2737 |
|
2738 return state; |
|
2739 }, |
|
2740 isSaving: function isSaving() { |
|
2741 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2742 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2743 |
|
2744 switch (action.type) { |
|
2745 case 'SAVE_REUSABLE_BLOCK': |
|
2746 return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.id, true)); |
|
2747 |
|
2748 case 'SAVE_REUSABLE_BLOCK_SUCCESS': |
|
2749 case 'SAVE_REUSABLE_BLOCK_FAILURE': |
|
2750 { |
|
2751 var id = action.id; |
|
2752 return Object(external_this_lodash_["omit"])(state, id); |
|
2753 } |
|
2754 } |
|
2755 |
|
2756 return state; |
|
2757 } |
|
2758 }); |
|
2759 /** |
|
2760 * Reducer returning whether the editor is ready to be rendered. |
|
2761 * The editor is considered ready to be rendered once |
|
2762 * the post object is loaded properly and the initial blocks parsed. |
|
2763 * |
|
2764 * @param {boolean} state |
|
2765 * @param {Object} action |
|
2766 * |
|
2767 * @return {boolean} Updated state. |
|
2768 */ |
|
2769 |
|
2770 function reducer_isReady() { |
|
2771 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
2772 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2773 |
|
2774 switch (action.type) { |
|
2775 case 'SETUP_EDITOR_STATE': |
|
2776 return true; |
|
2777 |
|
2778 case 'TEAR_DOWN_EDITOR': |
|
2779 return false; |
|
2780 } |
|
2781 |
|
2782 return state; |
|
2783 } |
|
2784 /** |
|
2785 * Reducer returning the post editor setting. |
|
2786 * |
|
2787 * @param {Object} state Current state. |
|
2788 * @param {Object} action Dispatched action. |
|
2789 * |
|
2790 * @return {Object} Updated state. |
|
2791 */ |
|
2792 |
|
2793 function reducer_editorSettings() { |
|
2794 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS; |
|
2795 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
2796 |
|
2797 switch (action.type) { |
|
2798 case 'UPDATE_EDITOR_SETTINGS': |
|
2799 return reducer_objectSpread({}, state, {}, action.settings); |
|
2800 } |
|
2801 |
|
2802 return state; |
|
2803 } |
|
2804 /* harmony default export */ var reducer = (redux_optimist_default()(Object(external_this_wp_data_["combineReducers"])({ |
|
2805 postId: reducer_postId, |
|
2806 postType: reducer_postType, |
|
2807 preferences: preferences, |
|
2808 saving: saving, |
|
2809 postLock: postLock, |
|
2810 reusableBlocks: reducer_reusableBlocks, |
|
2811 template: reducer_template, |
|
2812 postSavingLock: postSavingLock, |
|
2813 isReady: reducer_isReady, |
|
2814 editorSettings: reducer_editorSettings, |
|
2815 postAutosavingLock: postAutosavingLock |
|
2816 }))); |
|
2817 |
|
2818 // EXTERNAL MODULE: ./node_modules/refx/refx.js |
|
2819 var refx = __webpack_require__(110); |
|
2820 var refx_default = /*#__PURE__*/__webpack_require__.n(refx); |
|
2821 |
|
2822 // EXTERNAL MODULE: external {"this":"regeneratorRuntime"} |
|
2823 var external_this_regeneratorRuntime_ = __webpack_require__(24); |
|
2824 var external_this_regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(external_this_regeneratorRuntime_); |
|
2825 |
|
2826 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js |
|
2827 var asyncToGenerator = __webpack_require__(50); |
|
2828 |
|
2829 // EXTERNAL MODULE: external {"this":["wp","apiFetch"]} |
|
2830 var external_this_wp_apiFetch_ = __webpack_require__(45); |
|
2831 var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_); |
|
2832 |
|
2833 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
2834 var external_this_wp_i18n_ = __webpack_require__(1); |
|
2835 |
|
2836 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
2837 var toConsumableArray = __webpack_require__(18); |
|
2838 |
|
2839 // EXTERNAL MODULE: external {"this":["wp","deprecated"]} |
|
2840 var external_this_wp_deprecated_ = __webpack_require__(37); |
|
2841 var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); |
|
2842 |
|
2955 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js |
2843 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js |
2956 /** |
2844 /** |
2957 * Set of post properties for which edits should assume a merging behavior, |
2845 * Set of post properties for which edits should assume a merging behavior, |
2958 * assuming an object value. |
2846 * assuming an object value. |
2959 * |
2847 * |
2960 * @type {Set} |
2848 * @type {Set} |
2961 */ |
2849 */ |
2962 var EDIT_MERGE_PROPERTIES = new Set(['meta']); |
2850 var EDIT_MERGE_PROPERTIES = new Set(['meta']); |
2963 /** |
2851 /** |
2964 * Constant for the store module (or reducer) key. |
2852 * Constant for the store module (or reducer) key. |
2853 * |
|
2965 * @type {string} |
2854 * @type {string} |
2966 */ |
2855 */ |
2967 |
2856 |
2968 var STORE_KEY = 'core/editor'; |
2857 var STORE_KEY = 'core/editor'; |
2969 var POST_UPDATE_TRANSACTION_ID = 'post-update'; |
2858 var POST_UPDATE_TRANSACTION_ID = 'post-update'; |
2970 var SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; |
2859 var SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; |
2971 var TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; |
2860 var TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; |
2972 var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; |
2861 var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; |
2973 var ONE_MINUTE_IN_MS = 60 * 1000; |
2862 var ONE_MINUTE_IN_MS = 60 * 1000; |
2974 |
2863 var AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; |
2975 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/with-change-detection/index.js |
|
2976 |
|
2977 |
|
2978 /** |
|
2979 * External dependencies |
|
2980 */ |
|
2981 |
|
2982 /** |
|
2983 * Higher-order reducer creator for tracking changes to state over time. The |
|
2984 * returned reducer will include a `isDirty` property on the object reflecting |
|
2985 * whether the original reference of the reducer has changed. |
|
2986 * |
|
2987 * @param {?Object} options Optional options. |
|
2988 * @param {?Array} options.ignoreTypes Action types upon which to skip check. |
|
2989 * @param {?Array} options.resetTypes Action types upon which to reset dirty. |
|
2990 * |
|
2991 * @return {Function} Higher-order reducer. |
|
2992 */ |
|
2993 |
|
2994 var with_change_detection_withChangeDetection = function withChangeDetection() { |
|
2995 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
2996 return function (reducer) { |
|
2997 return function (state, action) { |
|
2998 var nextState = reducer(state, action); // Reset at: |
|
2999 // - Initial state |
|
3000 // - Reset types |
|
3001 |
|
3002 var isReset = state === undefined || Object(external_lodash_["includes"])(options.resetTypes, action.type); |
|
3003 var isChanging = state !== nextState; // If not intending to update dirty flag, return early and avoid clone. |
|
3004 |
|
3005 if (!isChanging && !isReset) { |
|
3006 return state; |
|
3007 } // Avoid mutating state, unless it's already changing by original |
|
3008 // reducer and not initial. |
|
3009 |
|
3010 |
|
3011 if (!isChanging || state === undefined) { |
|
3012 nextState = Object(objectSpread["a" /* default */])({}, nextState); |
|
3013 } |
|
3014 |
|
3015 var isIgnored = Object(external_lodash_["includes"])(options.ignoreTypes, action.type); |
|
3016 |
|
3017 if (isIgnored) { |
|
3018 // Preserve the original value if ignored. |
|
3019 nextState.isDirty = state.isDirty; |
|
3020 } else { |
|
3021 nextState.isDirty = !isReset && isChanging; |
|
3022 } |
|
3023 |
|
3024 return nextState; |
|
3025 }; |
|
3026 }; |
|
3027 }; |
|
3028 |
|
3029 /* harmony default export */ var with_change_detection = (with_change_detection_withChangeDetection); |
|
3030 |
|
3031 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
3032 var toConsumableArray = __webpack_require__(17); |
|
3033 |
|
3034 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/with-history/index.js |
|
3035 |
|
3036 |
|
3037 |
|
3038 /** |
|
3039 * External dependencies |
|
3040 */ |
|
3041 |
|
3042 /** |
|
3043 * Default options for withHistory reducer enhancer. Refer to withHistory |
|
3044 * documentation for options explanation. |
|
3045 * |
|
3046 * @see withHistory |
|
3047 * |
|
3048 * @type {Object} |
|
3049 */ |
|
3050 |
|
3051 var DEFAULT_OPTIONS = { |
|
3052 resetTypes: [], |
|
3053 ignoreTypes: [], |
|
3054 shouldOverwriteState: function shouldOverwriteState() { |
|
3055 return false; |
|
3056 } |
|
3057 }; |
|
3058 /** |
|
3059 * Higher-order reducer creator which transforms the result of the original |
|
3060 * reducer into an object tracking its own history (past, present, future). |
|
3061 * |
|
3062 * @param {?Object} options Optional options. |
|
3063 * @param {?Array} options.resetTypes Action types upon which to |
|
3064 * clear past. |
|
3065 * @param {?Array} options.ignoreTypes Action types upon which to |
|
3066 * avoid history tracking. |
|
3067 * @param {?Function} options.shouldOverwriteState Function receiving last and |
|
3068 * current actions, returning |
|
3069 * boolean indicating whether |
|
3070 * present should be merged, |
|
3071 * rather than add undo level. |
|
3072 * |
|
3073 * @return {Function} Higher-order reducer. |
|
3074 */ |
|
3075 |
|
3076 var with_history_withHistory = function withHistory() { |
|
3077 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3078 return function (reducer) { |
|
3079 options = Object(objectSpread["a" /* default */])({}, DEFAULT_OPTIONS, options); // `ignoreTypes` is simply a convenience for `shouldOverwriteState` |
|
3080 |
|
3081 options.shouldOverwriteState = Object(external_lodash_["overSome"])([options.shouldOverwriteState, function (action) { |
|
3082 return Object(external_lodash_["includes"])(options.ignoreTypes, action.type); |
|
3083 }]); |
|
3084 var initialState = { |
|
3085 past: [], |
|
3086 present: reducer(undefined, {}), |
|
3087 future: [], |
|
3088 lastAction: null, |
|
3089 shouldCreateUndoLevel: false |
|
3090 }; |
|
3091 var _options = options, |
|
3092 _options$resetTypes = _options.resetTypes, |
|
3093 resetTypes = _options$resetTypes === void 0 ? [] : _options$resetTypes, |
|
3094 _options$shouldOverwr = _options.shouldOverwriteState, |
|
3095 shouldOverwriteState = _options$shouldOverwr === void 0 ? function () { |
|
3096 return false; |
|
3097 } : _options$shouldOverwr; |
|
3098 return function () { |
|
3099 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; |
|
3100 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3101 var past = state.past, |
|
3102 present = state.present, |
|
3103 future = state.future, |
|
3104 lastAction = state.lastAction, |
|
3105 shouldCreateUndoLevel = state.shouldCreateUndoLevel; |
|
3106 var previousAction = lastAction; |
|
3107 |
|
3108 switch (action.type) { |
|
3109 case 'UNDO': |
|
3110 // Can't undo if no past. |
|
3111 if (!past.length) { |
|
3112 return state; |
|
3113 } |
|
3114 |
|
3115 return { |
|
3116 past: Object(external_lodash_["dropRight"])(past), |
|
3117 present: Object(external_lodash_["last"])(past), |
|
3118 future: [present].concat(Object(toConsumableArray["a" /* default */])(future)), |
|
3119 lastAction: null, |
|
3120 shouldCreateUndoLevel: false |
|
3121 }; |
|
3122 |
|
3123 case 'REDO': |
|
3124 // Can't redo if no future. |
|
3125 if (!future.length) { |
|
3126 return state; |
|
3127 } |
|
3128 |
|
3129 return { |
|
3130 past: [].concat(Object(toConsumableArray["a" /* default */])(past), [present]), |
|
3131 present: Object(external_lodash_["first"])(future), |
|
3132 future: Object(external_lodash_["drop"])(future), |
|
3133 lastAction: null, |
|
3134 shouldCreateUndoLevel: false |
|
3135 }; |
|
3136 |
|
3137 case 'CREATE_UNDO_LEVEL': |
|
3138 return Object(objectSpread["a" /* default */])({}, state, { |
|
3139 lastAction: null, |
|
3140 shouldCreateUndoLevel: true |
|
3141 }); |
|
3142 } |
|
3143 |
|
3144 var nextPresent = reducer(present, action); |
|
3145 |
|
3146 if (Object(external_lodash_["includes"])(resetTypes, action.type)) { |
|
3147 return { |
|
3148 past: [], |
|
3149 present: nextPresent, |
|
3150 future: [], |
|
3151 lastAction: null, |
|
3152 shouldCreateUndoLevel: false |
|
3153 }; |
|
3154 } |
|
3155 |
|
3156 if (present === nextPresent) { |
|
3157 return state; |
|
3158 } |
|
3159 |
|
3160 var nextPast = past; // The `lastAction` property is used to compare actions in the |
|
3161 // `shouldOverwriteState` option. If an action should be ignored, do not |
|
3162 // submit that action as the last action, otherwise the ability to |
|
3163 // compare subsequent actions will break. |
|
3164 |
|
3165 var lastActionToSubmit = previousAction; |
|
3166 |
|
3167 if (shouldCreateUndoLevel || !past.length || !shouldOverwriteState(action, previousAction)) { |
|
3168 nextPast = [].concat(Object(toConsumableArray["a" /* default */])(past), [present]); |
|
3169 lastActionToSubmit = action; |
|
3170 } |
|
3171 |
|
3172 return { |
|
3173 past: nextPast, |
|
3174 present: nextPresent, |
|
3175 future: [], |
|
3176 shouldCreateUndoLevel: false, |
|
3177 lastAction: lastActionToSubmit |
|
3178 }; |
|
3179 }; |
|
3180 }; |
|
3181 }; |
|
3182 |
|
3183 /* harmony default export */ var with_history = (with_history_withHistory); |
|
3184 |
|
3185 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 /** |
|
3192 * External dependencies |
|
3193 */ |
|
3194 |
|
3195 |
|
3196 /** |
|
3197 * WordPress dependencies |
|
3198 */ |
|
3199 |
|
3200 |
|
3201 |
|
3202 /** |
|
3203 * Internal dependencies |
|
3204 */ |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 /** |
|
3211 * Returns a post attribute value, flattening nested rendered content using its |
|
3212 * raw value in place of its original object form. |
|
3213 * |
|
3214 * @param {*} value Original value. |
|
3215 * |
|
3216 * @return {*} Raw value. |
|
3217 */ |
|
3218 |
|
3219 function getPostRawValue(value) { |
|
3220 if (value && 'object' === Object(esm_typeof["a" /* default */])(value) && 'raw' in value) { |
|
3221 return value.raw; |
|
3222 } |
|
3223 |
|
3224 return value; |
|
3225 } |
|
3226 /** |
|
3227 * Returns an object against which it is safe to perform mutating operations, |
|
3228 * given the original object and its current working copy. |
|
3229 * |
|
3230 * @param {Object} original Original object. |
|
3231 * @param {Object} working Working object. |
|
3232 * |
|
3233 * @return {Object} Mutation-safe object. |
|
3234 */ |
|
3235 |
|
3236 function getMutateSafeObject(original, working) { |
|
3237 if (original === working) { |
|
3238 return Object(objectSpread["a" /* default */])({}, original); |
|
3239 } |
|
3240 |
|
3241 return working; |
|
3242 } |
|
3243 /** |
|
3244 * Returns true if the two object arguments have the same keys, or false |
|
3245 * otherwise. |
|
3246 * |
|
3247 * @param {Object} a First object. |
|
3248 * @param {Object} b Second object. |
|
3249 * |
|
3250 * @return {boolean} Whether the two objects have the same keys. |
|
3251 */ |
|
3252 |
|
3253 |
|
3254 function hasSameKeys(a, b) { |
|
3255 return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b)); |
|
3256 } |
|
3257 /** |
|
3258 * Returns true if, given the currently dispatching action and the previously |
|
3259 * dispatched action, the two actions are editing the same post property, or |
|
3260 * false otherwise. |
|
3261 * |
|
3262 * @param {Object} action Currently dispatching action. |
|
3263 * @param {Object} previousAction Previously dispatched action. |
|
3264 * |
|
3265 * @return {boolean} Whether actions are updating the same post property. |
|
3266 */ |
|
3267 |
|
3268 function isUpdatingSamePostProperty(action, previousAction) { |
|
3269 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); |
|
3270 } |
|
3271 /** |
|
3272 * Returns true if, given the currently dispatching action and the previously |
|
3273 * dispatched action, the two actions are modifying the same property such that |
|
3274 * undo history should be batched. |
|
3275 * |
|
3276 * @param {Object} action Currently dispatching action. |
|
3277 * @param {Object} previousAction Previously dispatched action. |
|
3278 * |
|
3279 * @return {boolean} Whether to overwrite present state. |
|
3280 */ |
|
3281 |
|
3282 function reducer_shouldOverwriteState(action, previousAction) { |
|
3283 if (action.type === 'RESET_EDITOR_BLOCKS') { |
|
3284 return !action.shouldCreateUndoLevel; |
|
3285 } |
|
3286 |
|
3287 if (!previousAction || action.type !== previousAction.type) { |
|
3288 return false; |
|
3289 } |
|
3290 |
|
3291 return isUpdatingSamePostProperty(action, previousAction); |
|
3292 } |
|
3293 /** |
|
3294 * Undoable reducer returning the editor post state, including blocks parsed |
|
3295 * from current HTML markup. |
|
3296 * |
|
3297 * Handles the following state keys: |
|
3298 * - edits: an object describing changes to be made to the current post, in |
|
3299 * the format accepted by the WP REST API |
|
3300 * - blocks: post content blocks |
|
3301 * |
|
3302 * @param {Object} state Current state. |
|
3303 * @param {Object} action Dispatched action. |
|
3304 * |
|
3305 * @returns {Object} Updated state. |
|
3306 */ |
|
3307 |
|
3308 var editor = Object(external_lodash_["flow"])([external_this_wp_data_["combineReducers"], with_history({ |
|
3309 resetTypes: ['SETUP_EDITOR_STATE'], |
|
3310 ignoreTypes: ['RESET_POST', 'UPDATE_POST'], |
|
3311 shouldOverwriteState: reducer_shouldOverwriteState |
|
3312 })])({ |
|
3313 // Track whether changes exist, resetting at each post save. Relies on |
|
3314 // editor initialization firing post reset as an effect. |
|
3315 blocks: with_change_detection({ |
|
3316 resetTypes: ['SETUP_EDITOR_STATE', 'REQUEST_POST_UPDATE_START'] |
|
3317 })(function () { |
|
3318 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
3319 value: [] |
|
3320 }; |
|
3321 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3322 |
|
3323 switch (action.type) { |
|
3324 case 'RESET_EDITOR_BLOCKS': |
|
3325 if (action.blocks === state.value) { |
|
3326 return state; |
|
3327 } |
|
3328 |
|
3329 return { |
|
3330 value: action.blocks |
|
3331 }; |
|
3332 } |
|
3333 |
|
3334 return state; |
|
3335 }), |
|
3336 edits: function edits() { |
|
3337 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3338 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3339 |
|
3340 switch (action.type) { |
|
3341 case 'EDIT_POST': |
|
3342 return Object(external_lodash_["reduce"])(action.edits, function (result, value, key) { |
|
3343 // Only assign into result if not already same value |
|
3344 if (value !== state[key]) { |
|
3345 result = getMutateSafeObject(state, result); |
|
3346 |
|
3347 if (EDIT_MERGE_PROPERTIES.has(key)) { |
|
3348 // Merge properties should assign to current value. |
|
3349 result[key] = Object(objectSpread["a" /* default */])({}, result[key], value); |
|
3350 } else { |
|
3351 // Otherwise override. |
|
3352 result[key] = value; |
|
3353 } |
|
3354 } |
|
3355 |
|
3356 return result; |
|
3357 }, state); |
|
3358 |
|
3359 case 'UPDATE_POST': |
|
3360 case 'RESET_POST': |
|
3361 var getCanonicalValue = action.type === 'UPDATE_POST' ? function (key) { |
|
3362 return action.edits[key]; |
|
3363 } : function (key) { |
|
3364 return getPostRawValue(action.post[key]); |
|
3365 }; |
|
3366 return Object(external_lodash_["reduce"])(state, function (result, value, key) { |
|
3367 if (!Object(external_lodash_["isEqual"])(value, getCanonicalValue(key))) { |
|
3368 return result; |
|
3369 } |
|
3370 |
|
3371 result = getMutateSafeObject(state, result); |
|
3372 delete result[key]; |
|
3373 return result; |
|
3374 }, state); |
|
3375 |
|
3376 case 'RESET_EDITOR_BLOCKS': |
|
3377 if ('content' in state) { |
|
3378 return Object(external_lodash_["omit"])(state, 'content'); |
|
3379 } |
|
3380 |
|
3381 return state; |
|
3382 } |
|
3383 |
|
3384 return state; |
|
3385 } |
|
3386 }); |
|
3387 /** |
|
3388 * Reducer returning the initial edits state. With matching shape to that of |
|
3389 * `editor.edits`, the initial edits are those applied programmatically, are |
|
3390 * not considered in prompting the user for unsaved changes, and are included |
|
3391 * in (and reset by) the next save payload. |
|
3392 * |
|
3393 * @param {Object} state Current state. |
|
3394 * @param {Object} action Action object. |
|
3395 * |
|
3396 * @return {Object} Next state. |
|
3397 */ |
|
3398 |
|
3399 function initialEdits() { |
|
3400 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_EDITS_DEFAULTS; |
|
3401 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3402 |
|
3403 switch (action.type) { |
|
3404 case 'SETUP_EDITOR': |
|
3405 if (!action.edits) { |
|
3406 break; |
|
3407 } |
|
3408 |
|
3409 return action.edits; |
|
3410 |
|
3411 case 'SETUP_EDITOR_STATE': |
|
3412 if ('content' in state) { |
|
3413 return Object(external_lodash_["omit"])(state, 'content'); |
|
3414 } |
|
3415 |
|
3416 return state; |
|
3417 |
|
3418 case 'UPDATE_POST': |
|
3419 return Object(external_lodash_["reduce"])(action.edits, function (result, value, key) { |
|
3420 if (!result.hasOwnProperty(key)) { |
|
3421 return result; |
|
3422 } |
|
3423 |
|
3424 result = getMutateSafeObject(state, result); |
|
3425 delete result[key]; |
|
3426 return result; |
|
3427 }, state); |
|
3428 |
|
3429 case 'RESET_POST': |
|
3430 return INITIAL_EDITS_DEFAULTS; |
|
3431 } |
|
3432 |
|
3433 return state; |
|
3434 } |
|
3435 /** |
|
3436 * Reducer returning the last-known state of the current post, in the format |
|
3437 * returned by the WP REST API. |
|
3438 * |
|
3439 * @param {Object} state Current state. |
|
3440 * @param {Object} action Dispatched action. |
|
3441 * |
|
3442 * @return {Object} Updated state. |
|
3443 */ |
|
3444 |
|
3445 function currentPost() { |
|
3446 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3447 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3448 |
|
3449 switch (action.type) { |
|
3450 case 'SETUP_EDITOR_STATE': |
|
3451 case 'RESET_POST': |
|
3452 case 'UPDATE_POST': |
|
3453 var post; |
|
3454 |
|
3455 if (action.post) { |
|
3456 post = action.post; |
|
3457 } else if (action.edits) { |
|
3458 post = Object(objectSpread["a" /* default */])({}, state, action.edits); |
|
3459 } else { |
|
3460 return state; |
|
3461 } |
|
3462 |
|
3463 return Object(external_lodash_["mapValues"])(post, getPostRawValue); |
|
3464 } |
|
3465 |
|
3466 return state; |
|
3467 } |
|
3468 /** |
|
3469 * Reducer returning typing state. |
|
3470 * |
|
3471 * @param {boolean} state Current state. |
|
3472 * @param {Object} action Dispatched action. |
|
3473 * |
|
3474 * @return {boolean} Updated state. |
|
3475 */ |
|
3476 |
|
3477 function isTyping() { |
|
3478 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
3479 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3480 |
|
3481 switch (action.type) { |
|
3482 case 'START_TYPING': |
|
3483 return true; |
|
3484 |
|
3485 case 'STOP_TYPING': |
|
3486 return false; |
|
3487 } |
|
3488 |
|
3489 return state; |
|
3490 } |
|
3491 /** |
|
3492 * Reducer returning whether the caret is within formatted text. |
|
3493 * |
|
3494 * @param {boolean} state Current state. |
|
3495 * @param {Object} action Dispatched action. |
|
3496 * |
|
3497 * @return {boolean} Updated state. |
|
3498 */ |
|
3499 |
|
3500 function isCaretWithinFormattedText() { |
|
3501 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
3502 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3503 |
|
3504 switch (action.type) { |
|
3505 case 'ENTER_FORMATTED_TEXT': |
|
3506 return true; |
|
3507 |
|
3508 case 'EXIT_FORMATTED_TEXT': |
|
3509 return false; |
|
3510 } |
|
3511 |
|
3512 return state; |
|
3513 } |
|
3514 /** |
|
3515 * Reducer returning the block selection's state. |
|
3516 * |
|
3517 * @param {Object} state Current state. |
|
3518 * @param {Object} action Dispatched action. |
|
3519 * |
|
3520 * @return {Object} Updated state. |
|
3521 */ |
|
3522 |
|
3523 function blockSelection() { |
|
3524 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
3525 start: null, |
|
3526 end: null, |
|
3527 isMultiSelecting: false, |
|
3528 isEnabled: true, |
|
3529 initialPosition: null |
|
3530 }; |
|
3531 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3532 |
|
3533 switch (action.type) { |
|
3534 case 'CLEAR_SELECTED_BLOCK': |
|
3535 if (state.start === null && state.end === null && !state.isMultiSelecting) { |
|
3536 return state; |
|
3537 } |
|
3538 |
|
3539 return Object(objectSpread["a" /* default */])({}, state, { |
|
3540 start: null, |
|
3541 end: null, |
|
3542 isMultiSelecting: false, |
|
3543 initialPosition: null |
|
3544 }); |
|
3545 |
|
3546 case 'START_MULTI_SELECT': |
|
3547 if (state.isMultiSelecting) { |
|
3548 return state; |
|
3549 } |
|
3550 |
|
3551 return Object(objectSpread["a" /* default */])({}, state, { |
|
3552 isMultiSelecting: true, |
|
3553 initialPosition: null |
|
3554 }); |
|
3555 |
|
3556 case 'STOP_MULTI_SELECT': |
|
3557 if (!state.isMultiSelecting) { |
|
3558 return state; |
|
3559 } |
|
3560 |
|
3561 return Object(objectSpread["a" /* default */])({}, state, { |
|
3562 isMultiSelecting: false, |
|
3563 initialPosition: null |
|
3564 }); |
|
3565 |
|
3566 case 'MULTI_SELECT': |
|
3567 return Object(objectSpread["a" /* default */])({}, state, { |
|
3568 start: action.start, |
|
3569 end: action.end, |
|
3570 initialPosition: null |
|
3571 }); |
|
3572 |
|
3573 case 'SELECT_BLOCK': |
|
3574 if (action.clientId === state.start && action.clientId === state.end) { |
|
3575 return state; |
|
3576 } |
|
3577 |
|
3578 return Object(objectSpread["a" /* default */])({}, state, { |
|
3579 start: action.clientId, |
|
3580 end: action.clientId, |
|
3581 initialPosition: action.initialPosition |
|
3582 }); |
|
3583 |
|
3584 case 'INSERT_BLOCKS': |
|
3585 { |
|
3586 if (action.updateSelection) { |
|
3587 return Object(objectSpread["a" /* default */])({}, state, { |
|
3588 start: action.blocks[0].clientId, |
|
3589 end: action.blocks[0].clientId, |
|
3590 initialPosition: null, |
|
3591 isMultiSelecting: false |
|
3592 }); |
|
3593 } |
|
3594 |
|
3595 return state; |
|
3596 } |
|
3597 |
|
3598 case 'REMOVE_BLOCKS': |
|
3599 if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.start) === -1) { |
|
3600 return state; |
|
3601 } |
|
3602 |
|
3603 return Object(objectSpread["a" /* default */])({}, state, { |
|
3604 start: null, |
|
3605 end: null, |
|
3606 initialPosition: null, |
|
3607 isMultiSelecting: false |
|
3608 }); |
|
3609 |
|
3610 case 'REPLACE_BLOCKS': |
|
3611 if (action.clientIds.indexOf(state.start) === -1) { |
|
3612 return state; |
|
3613 } // If there are replacement blocks, assign last block as the next |
|
3614 // selected block, otherwise set to null. |
|
3615 |
|
3616 |
|
3617 var lastBlock = Object(external_lodash_["last"])(action.blocks); |
|
3618 var nextSelectedBlockClientId = lastBlock ? lastBlock.clientId : null; |
|
3619 |
|
3620 if (nextSelectedBlockClientId === state.start && nextSelectedBlockClientId === state.end) { |
|
3621 return state; |
|
3622 } |
|
3623 |
|
3624 return Object(objectSpread["a" /* default */])({}, state, { |
|
3625 start: nextSelectedBlockClientId, |
|
3626 end: nextSelectedBlockClientId, |
|
3627 initialPosition: null, |
|
3628 isMultiSelecting: false |
|
3629 }); |
|
3630 |
|
3631 case 'TOGGLE_SELECTION': |
|
3632 return Object(objectSpread["a" /* default */])({}, state, { |
|
3633 isEnabled: action.isSelectionEnabled |
|
3634 }); |
|
3635 } |
|
3636 |
|
3637 return state; |
|
3638 } |
|
3639 function blocksMode() { |
|
3640 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3641 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3642 |
|
3643 if (action.type === 'TOGGLE_BLOCK_MODE') { |
|
3644 var clientId = action.clientId; |
|
3645 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, clientId, state[clientId] && state[clientId] === 'html' ? 'visual' : 'html')); |
|
3646 } |
|
3647 |
|
3648 return state; |
|
3649 } |
|
3650 /** |
|
3651 * Reducer returning the block insertion point visibility, either null if there |
|
3652 * is not an explicit insertion point assigned, or an object of its `index` and |
|
3653 * `rootClientId`. |
|
3654 * |
|
3655 * @param {Object} state Current state. |
|
3656 * @param {Object} action Dispatched action. |
|
3657 * |
|
3658 * @return {Object} Updated state. |
|
3659 */ |
|
3660 |
|
3661 function insertionPoint() { |
|
3662 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
3663 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3664 |
|
3665 switch (action.type) { |
|
3666 case 'SHOW_INSERTION_POINT': |
|
3667 var rootClientId = action.rootClientId, |
|
3668 index = action.index; |
|
3669 return { |
|
3670 rootClientId: rootClientId, |
|
3671 index: index |
|
3672 }; |
|
3673 |
|
3674 case 'HIDE_INSERTION_POINT': |
|
3675 return null; |
|
3676 } |
|
3677 |
|
3678 return state; |
|
3679 } |
|
3680 /** |
|
3681 * Reducer returning whether the post blocks match the defined template or not. |
|
3682 * |
|
3683 * @param {Object} state Current state. |
|
3684 * @param {Object} action Dispatched action. |
|
3685 * |
|
3686 * @return {boolean} Updated state. |
|
3687 */ |
|
3688 |
|
3689 function reducer_template() { |
|
3690 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
3691 isValid: true |
|
3692 }; |
|
3693 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3694 |
|
3695 switch (action.type) { |
|
3696 case 'SET_TEMPLATE_VALIDITY': |
|
3697 return Object(objectSpread["a" /* default */])({}, state, { |
|
3698 isValid: action.isValid |
|
3699 }); |
|
3700 } |
|
3701 |
|
3702 return state; |
|
3703 } |
|
3704 /** |
|
3705 * Reducer returning the user preferences. |
|
3706 * |
|
3707 * @param {Object} state Current state. |
|
3708 * @param {Object} action Dispatched action. |
|
3709 * |
|
3710 * @return {string} Updated state. |
|
3711 */ |
|
3712 |
|
3713 function preferences() { |
|
3714 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS; |
|
3715 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3716 |
|
3717 switch (action.type) { |
|
3718 case 'ENABLE_PUBLISH_SIDEBAR': |
|
3719 return Object(objectSpread["a" /* default */])({}, state, { |
|
3720 isPublishSidebarEnabled: true |
|
3721 }); |
|
3722 |
|
3723 case 'DISABLE_PUBLISH_SIDEBAR': |
|
3724 return Object(objectSpread["a" /* default */])({}, state, { |
|
3725 isPublishSidebarEnabled: false |
|
3726 }); |
|
3727 } |
|
3728 |
|
3729 return state; |
|
3730 } |
|
3731 /** |
|
3732 * Reducer returning current network request state (whether a request to |
|
3733 * the WP REST API is in progress, successful, or failed). |
|
3734 * |
|
3735 * @param {Object} state Current state. |
|
3736 * @param {Object} action Dispatched action. |
|
3737 * |
|
3738 * @return {Object} Updated state. |
|
3739 */ |
|
3740 |
|
3741 function saving() { |
|
3742 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3743 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3744 |
|
3745 switch (action.type) { |
|
3746 case 'REQUEST_POST_UPDATE_START': |
|
3747 return { |
|
3748 requesting: true, |
|
3749 successful: false, |
|
3750 error: null, |
|
3751 options: action.options || {} |
|
3752 }; |
|
3753 |
|
3754 case 'REQUEST_POST_UPDATE_SUCCESS': |
|
3755 return { |
|
3756 requesting: false, |
|
3757 successful: true, |
|
3758 error: null, |
|
3759 options: action.options || {} |
|
3760 }; |
|
3761 |
|
3762 case 'REQUEST_POST_UPDATE_FAILURE': |
|
3763 return { |
|
3764 requesting: false, |
|
3765 successful: false, |
|
3766 error: action.error, |
|
3767 options: action.options || {} |
|
3768 }; |
|
3769 } |
|
3770 |
|
3771 return state; |
|
3772 } |
|
3773 /** |
|
3774 * Post Lock State. |
|
3775 * |
|
3776 * @typedef {Object} PostLockState |
|
3777 * |
|
3778 * @property {boolean} isLocked Whether the post is locked. |
|
3779 * @property {?boolean} isTakeover Whether the post editing has been taken over. |
|
3780 * @property {?boolean} activePostLock Active post lock value. |
|
3781 * @property {?Object} user User that took over the post. |
|
3782 */ |
|
3783 |
|
3784 /** |
|
3785 * Reducer returning the post lock status. |
|
3786 * |
|
3787 * @param {PostLockState} state Current state. |
|
3788 * @param {Object} action Dispatched action. |
|
3789 * |
|
3790 * @return {PostLockState} Updated state. |
|
3791 */ |
|
3792 |
|
3793 function postLock() { |
|
3794 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
3795 isLocked: false |
|
3796 }; |
|
3797 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3798 |
|
3799 switch (action.type) { |
|
3800 case 'UPDATE_POST_LOCK': |
|
3801 return action.lock; |
|
3802 } |
|
3803 |
|
3804 return state; |
|
3805 } |
|
3806 /** |
|
3807 * Post saving lock. |
|
3808 * |
|
3809 * When post saving is locked, the post cannot be published or updated. |
|
3810 * |
|
3811 * @param {PostSavingLockState} state Current state. |
|
3812 * @param {Object} action Dispatched action. |
|
3813 * |
|
3814 * @return {PostLockState} Updated state. |
|
3815 */ |
|
3816 |
|
3817 function postSavingLock() { |
|
3818 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3819 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3820 |
|
3821 switch (action.type) { |
|
3822 case 'LOCK_POST_SAVING': |
|
3823 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); |
|
3824 |
|
3825 case 'UNLOCK_POST_SAVING': |
|
3826 return Object(external_lodash_["omit"])(state, action.lockName); |
|
3827 } |
|
3828 |
|
3829 return state; |
|
3830 } |
|
3831 var reducer_reusableBlocks = Object(external_this_wp_data_["combineReducers"])({ |
|
3832 data: function data() { |
|
3833 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3834 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3835 |
|
3836 switch (action.type) { |
|
3837 case 'RECEIVE_REUSABLE_BLOCKS': |
|
3838 { |
|
3839 return Object(external_lodash_["reduce"])(action.results, function (nextState, result) { |
|
3840 var _result$reusableBlock = result.reusableBlock, |
|
3841 id = _result$reusableBlock.id, |
|
3842 title = _result$reusableBlock.title; |
|
3843 var clientId = result.parsedBlock.clientId; |
|
3844 var value = { |
|
3845 clientId: clientId, |
|
3846 title: title |
|
3847 }; |
|
3848 |
|
3849 if (!Object(external_lodash_["isEqual"])(nextState[id], value)) { |
|
3850 nextState = getMutateSafeObject(state, nextState); |
|
3851 nextState[id] = value; |
|
3852 } |
|
3853 |
|
3854 return nextState; |
|
3855 }, state); |
|
3856 } |
|
3857 |
|
3858 case 'UPDATE_REUSABLE_BLOCK_TITLE': |
|
3859 { |
|
3860 var id = action.id, |
|
3861 title = action.title; |
|
3862 |
|
3863 if (!state[id] || state[id].title === title) { |
|
3864 return state; |
|
3865 } |
|
3866 |
|
3867 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, id, Object(objectSpread["a" /* default */])({}, state[id], { |
|
3868 title: title |
|
3869 }))); |
|
3870 } |
|
3871 |
|
3872 case 'SAVE_REUSABLE_BLOCK_SUCCESS': |
|
3873 { |
|
3874 var _id = action.id, |
|
3875 updatedId = action.updatedId; // If a temporary reusable block is saved, we swap the temporary id with the final one |
|
3876 |
|
3877 if (_id === updatedId) { |
|
3878 return state; |
|
3879 } |
|
3880 |
|
3881 var value = state[_id]; |
|
3882 return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state, _id), Object(defineProperty["a" /* default */])({}, updatedId, value)); |
|
3883 } |
|
3884 |
|
3885 case 'REMOVE_REUSABLE_BLOCK': |
|
3886 { |
|
3887 var _id2 = action.id; |
|
3888 return Object(external_lodash_["omit"])(state, _id2); |
|
3889 } |
|
3890 } |
|
3891 |
|
3892 return state; |
|
3893 }, |
|
3894 isFetching: function isFetching() { |
|
3895 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3896 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3897 |
|
3898 switch (action.type) { |
|
3899 case 'FETCH_REUSABLE_BLOCKS': |
|
3900 { |
|
3901 var id = action.id; |
|
3902 |
|
3903 if (!id) { |
|
3904 return state; |
|
3905 } |
|
3906 |
|
3907 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, id, true)); |
|
3908 } |
|
3909 |
|
3910 case 'FETCH_REUSABLE_BLOCKS_SUCCESS': |
|
3911 case 'FETCH_REUSABLE_BLOCKS_FAILURE': |
|
3912 { |
|
3913 var _id3 = action.id; |
|
3914 return Object(external_lodash_["omit"])(state, _id3); |
|
3915 } |
|
3916 } |
|
3917 |
|
3918 return state; |
|
3919 }, |
|
3920 isSaving: function isSaving() { |
|
3921 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3922 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3923 |
|
3924 switch (action.type) { |
|
3925 case 'SAVE_REUSABLE_BLOCK': |
|
3926 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.id, true)); |
|
3927 |
|
3928 case 'SAVE_REUSABLE_BLOCK_SUCCESS': |
|
3929 case 'SAVE_REUSABLE_BLOCK_FAILURE': |
|
3930 { |
|
3931 var id = action.id; |
|
3932 return Object(external_lodash_["omit"])(state, id); |
|
3933 } |
|
3934 } |
|
3935 |
|
3936 return state; |
|
3937 } |
|
3938 }); |
|
3939 /** |
|
3940 * Reducer returning an object where each key is a block client ID, its value |
|
3941 * representing the settings for its nested blocks. |
|
3942 * |
|
3943 * @param {Object} state Current state. |
|
3944 * @param {Object} action Dispatched action. |
|
3945 * |
|
3946 * @return {Object} Updated state. |
|
3947 */ |
|
3948 |
|
3949 var reducer_blockListSettings = function blockListSettings() { |
|
3950 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3951 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3952 |
|
3953 switch (action.type) { |
|
3954 // Even if the replaced blocks have the same client ID, our logic |
|
3955 // should correct the state. |
|
3956 case 'REPLACE_BLOCKS': |
|
3957 case 'REMOVE_BLOCKS': |
|
3958 { |
|
3959 return Object(external_lodash_["omit"])(state, action.clientIds); |
|
3960 } |
|
3961 |
|
3962 case 'UPDATE_BLOCK_LIST_SETTINGS': |
|
3963 { |
|
3964 var clientId = action.clientId; |
|
3965 |
|
3966 if (!action.settings) { |
|
3967 if (state.hasOwnProperty(clientId)) { |
|
3968 return Object(external_lodash_["omit"])(state, clientId); |
|
3969 } |
|
3970 |
|
3971 return state; |
|
3972 } |
|
3973 |
|
3974 if (Object(external_lodash_["isEqual"])(state[clientId], action.settings)) { |
|
3975 return state; |
|
3976 } |
|
3977 |
|
3978 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, clientId, action.settings)); |
|
3979 } |
|
3980 } |
|
3981 |
|
3982 return state; |
|
3983 }; |
|
3984 /** |
|
3985 * Reducer returning the most recent autosave. |
|
3986 * |
|
3987 * @param {Object} state The autosave object. |
|
3988 * @param {Object} action Dispatched action. |
|
3989 * |
|
3990 * @return {Object} Updated state. |
|
3991 */ |
|
3992 |
|
3993 function autosave() { |
|
3994 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
3995 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
3996 |
|
3997 switch (action.type) { |
|
3998 case 'RESET_AUTOSAVE': |
|
3999 var post = action.post; |
|
4000 |
|
4001 var _map = ['title', 'excerpt', 'content'].map(function (field) { |
|
4002 return getPostRawValue(post[field]); |
|
4003 }), |
|
4004 _map2 = Object(slicedToArray["a" /* default */])(_map, 3), |
|
4005 title = _map2[0], |
|
4006 excerpt = _map2[1], |
|
4007 content = _map2[2]; |
|
4008 |
|
4009 return { |
|
4010 title: title, |
|
4011 excerpt: excerpt, |
|
4012 content: content |
|
4013 }; |
|
4014 } |
|
4015 |
|
4016 return state; |
|
4017 } |
|
4018 /** |
|
4019 * Reducer returning the post preview link. |
|
4020 * |
|
4021 * @param {string?} state The preview link |
|
4022 * @param {Object} action Dispatched action. |
|
4023 * |
|
4024 * @return {string?} Updated state. |
|
4025 */ |
|
4026 |
|
4027 function reducer_previewLink() { |
|
4028 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
4029 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
4030 |
|
4031 switch (action.type) { |
|
4032 case 'REQUEST_POST_UPDATE_SUCCESS': |
|
4033 if (action.post.preview_link) { |
|
4034 return action.post.preview_link; |
|
4035 } else if (action.post.link) { |
|
4036 return Object(external_this_wp_url_["addQueryArgs"])(action.post.link, { |
|
4037 preview: true |
|
4038 }); |
|
4039 } |
|
4040 |
|
4041 return state; |
|
4042 |
|
4043 case 'REQUEST_POST_UPDATE_START': |
|
4044 // Invalidate known preview link when autosave starts. |
|
4045 if (state && action.options.isPreview) { |
|
4046 return null; |
|
4047 } |
|
4048 |
|
4049 break; |
|
4050 } |
|
4051 |
|
4052 return state; |
|
4053 } |
|
4054 /** |
|
4055 * Reducer returning whether the editor is ready to be rendered. |
|
4056 * The editor is considered ready to be rendered once |
|
4057 * the post object is loaded properly and the initial blocks parsed. |
|
4058 * |
|
4059 * @param {boolean} state |
|
4060 * @param {Object} action |
|
4061 * |
|
4062 * @return {boolean} Updated state. |
|
4063 */ |
|
4064 |
|
4065 function reducer_isReady() { |
|
4066 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
4067 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
4068 |
|
4069 switch (action.type) { |
|
4070 case 'SETUP_EDITOR_STATE': |
|
4071 return true; |
|
4072 } |
|
4073 |
|
4074 return state; |
|
4075 } |
|
4076 /** |
|
4077 * Reducer returning the post editor setting. |
|
4078 * |
|
4079 * @param {Object} state Current state. |
|
4080 * @param {Object} action Dispatched action. |
|
4081 * |
|
4082 * @return {Object} Updated state. |
|
4083 */ |
|
4084 |
|
4085 function reducer_editorSettings() { |
|
4086 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS; |
|
4087 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
4088 |
|
4089 switch (action.type) { |
|
4090 case 'UPDATE_EDITOR_SETTINGS': |
|
4091 return Object(objectSpread["a" /* default */])({}, state, action.settings); |
|
4092 } |
|
4093 |
|
4094 return state; |
|
4095 } |
|
4096 /* harmony default export */ var store_reducer = (redux_optimist_default()(Object(external_this_wp_data_["combineReducers"])({ |
|
4097 editor: editor, |
|
4098 initialEdits: initialEdits, |
|
4099 currentPost: currentPost, |
|
4100 preferences: preferences, |
|
4101 saving: saving, |
|
4102 postLock: postLock, |
|
4103 reusableBlocks: reducer_reusableBlocks, |
|
4104 template: reducer_template, |
|
4105 autosave: autosave, |
|
4106 previewLink: reducer_previewLink, |
|
4107 postSavingLock: postSavingLock, |
|
4108 isReady: reducer_isReady, |
|
4109 editorSettings: reducer_editorSettings |
|
4110 }))); |
|
4111 |
|
4112 // EXTERNAL MODULE: ./node_modules/refx/refx.js |
|
4113 var refx = __webpack_require__(70); |
|
4114 var refx_default = /*#__PURE__*/__webpack_require__.n(refx); |
|
4115 |
|
4116 // EXTERNAL MODULE: ./node_modules/redux-multi/lib/index.js |
|
4117 var lib = __webpack_require__(97); |
|
4118 var lib_default = /*#__PURE__*/__webpack_require__.n(lib); |
|
4119 |
|
4120 // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js |
|
4121 var regenerator = __webpack_require__(23); |
|
4122 var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); |
|
4123 |
|
4124 // EXTERNAL MODULE: external {"this":["wp","apiFetch"]} |
|
4125 var external_this_wp_apiFetch_ = __webpack_require__(33); |
|
4126 var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_); |
|
4127 |
|
4128 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js |
|
4129 |
|
4130 |
|
4131 /** |
|
4132 * WordPress dependencies |
|
4133 */ |
|
4134 |
|
4135 |
|
4136 /** |
|
4137 * Dispatches a control action for triggering an api fetch call. |
|
4138 * |
|
4139 * @param {Object} request Arguments for the fetch request. |
|
4140 * |
|
4141 * @return {Object} control descriptor. |
|
4142 */ |
|
4143 |
|
4144 function apiFetch(request) { |
|
4145 return { |
|
4146 type: 'API_FETCH', |
|
4147 request: request |
|
4148 }; |
|
4149 } |
|
4150 /** |
|
4151 * Dispatches a control action for triggering a registry select. |
|
4152 * |
|
4153 * @param {string} storeKey |
|
4154 * @param {string} selectorName |
|
4155 * @param {Array} args Arguments for the select. |
|
4156 * |
|
4157 * @return {Object} control descriptor. |
|
4158 */ |
|
4159 |
|
4160 function controls_select(storeKey, selectorName) { |
|
4161 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { |
|
4162 args[_key - 2] = arguments[_key]; |
|
4163 } |
|
4164 |
|
4165 return { |
|
4166 type: 'SELECT', |
|
4167 storeKey: storeKey, |
|
4168 selectorName: selectorName, |
|
4169 args: args |
|
4170 }; |
|
4171 } |
|
4172 /** |
|
4173 * Dispatches a control action for triggering a registry select that has a |
|
4174 * resolver. |
|
4175 * |
|
4176 * @param {string} storeKey |
|
4177 * @param {string} selectorName |
|
4178 * @param {Array} args Arguments for the select. |
|
4179 * |
|
4180 * @return {Object} control descriptor. |
|
4181 */ |
|
4182 |
|
4183 function resolveSelect(storeKey, selectorName) { |
|
4184 for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { |
|
4185 args[_key2 - 2] = arguments[_key2]; |
|
4186 } |
|
4187 |
|
4188 return { |
|
4189 type: 'RESOLVE_SELECT', |
|
4190 storeKey: storeKey, |
|
4191 selectorName: selectorName, |
|
4192 args: args |
|
4193 }; |
|
4194 } |
|
4195 /** |
|
4196 * Dispatches a control action for triggering a registry dispatch. |
|
4197 * |
|
4198 * @param {string} storeKey |
|
4199 * @param {string} actionName |
|
4200 * @param {Array} args Arguments for the dispatch action. |
|
4201 * |
|
4202 * @return {Object} control descriptor. |
|
4203 */ |
|
4204 |
|
4205 function controls_dispatch(storeKey, actionName) { |
|
4206 for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { |
|
4207 args[_key3 - 2] = arguments[_key3]; |
|
4208 } |
|
4209 |
|
4210 return { |
|
4211 type: 'DISPATCH', |
|
4212 storeKey: storeKey, |
|
4213 actionName: actionName, |
|
4214 args: args |
|
4215 }; |
|
4216 } |
|
4217 /* harmony default export */ var controls = ({ |
|
4218 API_FETCH: function API_FETCH(_ref) { |
|
4219 var request = _ref.request; |
|
4220 return external_this_wp_apiFetch_default()(request); |
|
4221 }, |
|
4222 SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { |
|
4223 return function (_ref2) { |
|
4224 var _registry$select; |
|
4225 |
|
4226 var storeKey = _ref2.storeKey, |
|
4227 selectorName = _ref2.selectorName, |
|
4228 args = _ref2.args; |
|
4229 return (_registry$select = registry.select(storeKey))[selectorName].apply(_registry$select, Object(toConsumableArray["a" /* default */])(args)); |
|
4230 }; |
|
4231 }), |
|
4232 DISPATCH: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { |
|
4233 return function (_ref3) { |
|
4234 var _registry$dispatch; |
|
4235 |
|
4236 var storeKey = _ref3.storeKey, |
|
4237 actionName = _ref3.actionName, |
|
4238 args = _ref3.args; |
|
4239 return (_registry$dispatch = registry.dispatch(storeKey))[actionName].apply(_registry$dispatch, Object(toConsumableArray["a" /* default */])(args)); |
|
4240 }; |
|
4241 }), |
|
4242 RESOLVE_SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { |
|
4243 return function (_ref4) { |
|
4244 var storeKey = _ref4.storeKey, |
|
4245 selectorName = _ref4.selectorName, |
|
4246 args = _ref4.args; |
|
4247 return new Promise(function (resolve) { |
|
4248 var hasFinished = function hasFinished() { |
|
4249 return registry.select('core/data').hasFinishedResolution(storeKey, selectorName, args); |
|
4250 }; |
|
4251 |
|
4252 var getResult = function getResult() { |
|
4253 return registry.select(storeKey)[selectorName].apply(null, args); |
|
4254 }; // trigger the selector (to trigger the resolver) |
|
4255 |
|
4256 |
|
4257 var result = getResult(); |
|
4258 |
|
4259 if (hasFinished()) { |
|
4260 return resolve(result); |
|
4261 } |
|
4262 |
|
4263 var unsubscribe = registry.subscribe(function () { |
|
4264 if (hasFinished()) { |
|
4265 unsubscribe(); |
|
4266 resolve(getResult()); |
|
4267 } |
|
4268 }); |
|
4269 }); |
|
4270 }; |
|
4271 }) |
|
4272 }); |
|
4273 |
|
4274 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
4275 var external_this_wp_i18n_ = __webpack_require__(1); |
|
4276 |
2864 |
4277 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js |
2865 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js |
4278 /** |
2866 /** |
4279 * WordPress dependencies |
2867 * WordPress dependencies |
4280 */ |
2868 */ |
4301 function getNotificationArgumentsForSaveSuccess(data) { |
2889 function getNotificationArgumentsForSaveSuccess(data) { |
4302 var previousPost = data.previousPost, |
2890 var previousPost = data.previousPost, |
4303 post = data.post, |
2891 post = data.post, |
4304 postType = data.postType; // Autosaves are neither shown a notice nor redirected. |
2892 postType = data.postType; // Autosaves are neither shown a notice nor redirected. |
4305 |
2893 |
4306 if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) { |
2894 if (Object(external_this_lodash_["get"])(data.options, ['isAutosave'])) { |
4307 return []; |
2895 return []; |
4308 } |
2896 } |
4309 |
2897 |
4310 var publishStatus = ['publish', 'private', 'future']; |
2898 var publishStatus = ['publish', 'private', 'future']; |
4311 var isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status); |
2899 var isPublished = Object(external_this_lodash_["includes"])(publishStatus, previousPost.status); |
4312 var willPublish = Object(external_lodash_["includes"])(publishStatus, post.status); |
2900 var willPublish = Object(external_this_lodash_["includes"])(publishStatus, post.status); |
4313 var noticeMessage; |
2901 var noticeMessage; |
4314 var shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false); |
2902 var shouldShowLink = Object(external_this_lodash_["get"])(postType, ['viewable'], false); |
4315 |
2903 |
4316 if (!isPublished && !willPublish) { |
2904 if (!isPublished && !willPublish) { |
4317 // If saving a non-published post, don't show notice. |
2905 // If saving a non-published post, don't show notice. |
4318 noticeMessage = null; |
2906 noticeMessage = null; |
4319 } else if (isPublished && !willPublish) { |
2907 } else if (isPublished && !willPublish) { |
4343 }); |
2931 }); |
4344 } |
2932 } |
4345 |
2933 |
4346 return [noticeMessage, { |
2934 return [noticeMessage, { |
4347 id: SAVE_POST_NOTICE_ID, |
2935 id: SAVE_POST_NOTICE_ID, |
2936 type: 'snackbar', |
|
4348 actions: actions |
2937 actions: actions |
4349 }]; |
2938 }]; |
4350 } |
2939 } |
4351 |
2940 |
4352 return []; |
2941 return []; |
4374 var publishStatus = ['publish', 'private', 'future']; |
2963 var publishStatus = ['publish', 'private', 'future']; |
4375 var isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message |
2964 var isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message |
4376 // Unless we publish an "updating failed" message |
2965 // Unless we publish an "updating failed" message |
4377 |
2966 |
4378 var messages = { |
2967 var messages = { |
4379 publish: Object(external_this_wp_i18n_["__"])('Publishing failed'), |
2968 publish: Object(external_this_wp_i18n_["__"])('Publishing failed.'), |
4380 private: Object(external_this_wp_i18n_["__"])('Publishing failed'), |
2969 private: Object(external_this_wp_i18n_["__"])('Publishing failed.'), |
4381 future: Object(external_this_wp_i18n_["__"])('Scheduling failed') |
2970 future: Object(external_this_wp_i18n_["__"])('Scheduling failed.') |
4382 }; |
2971 }; |
4383 var noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_this_wp_i18n_["__"])('Updating failed'); |
2972 var noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_this_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only |
2973 // supported as plaintext, and stripping the tags may muddle the meaning. |
|
2974 |
|
2975 if (error.message && !/<\/?[^>]*>/.test(error.message)) { |
|
2976 noticeMessage = [noticeMessage, error.message].join(' '); |
|
2977 } |
|
2978 |
|
4384 return [noticeMessage, { |
2979 return [noticeMessage, { |
4385 id: SAVE_POST_NOTICE_ID |
2980 id: SAVE_POST_NOTICE_ID |
4386 }]; |
2981 }]; |
4387 } |
2982 } |
4388 /** |
2983 /** |
4397 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_this_wp_i18n_["__"])('Trashing failed'), { |
2992 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_this_wp_i18n_["__"])('Trashing failed'), { |
4398 id: TRASH_POST_NOTICE_ID |
2993 id: TRASH_POST_NOTICE_ID |
4399 }]; |
2994 }]; |
4400 } |
2995 } |
4401 |
2996 |
2997 // EXTERNAL MODULE: ./node_modules/memize/index.js |
|
2998 var memize = __webpack_require__(60); |
|
2999 var memize_default = /*#__PURE__*/__webpack_require__.n(memize); |
|
3000 |
|
3001 // EXTERNAL MODULE: external {"this":["wp","autop"]} |
|
3002 var external_this_wp_autop_ = __webpack_require__(103); |
|
3003 |
|
3004 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/serialize-blocks.js |
|
3005 /** |
|
3006 * External dependencies |
|
3007 */ |
|
3008 |
|
3009 /** |
|
3010 * WordPress dependencies |
|
3011 */ |
|
3012 |
|
3013 |
|
3014 |
|
3015 /** |
|
3016 * Serializes blocks following backwards compatibility conventions. |
|
3017 * |
|
3018 * @param {Array} blocksForSerialization The blocks to serialize. |
|
3019 * |
|
3020 * @return {string} The blocks serialization. |
|
3021 */ |
|
3022 |
|
3023 var serializeBlocks = memize_default()(function (blocksForSerialization) { |
|
3024 // A single unmodified default block is assumed to |
|
3025 // be equivalent to an empty post. |
|
3026 if (blocksForSerialization.length === 1 && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])(blocksForSerialization[0])) { |
|
3027 blocksForSerialization = []; |
|
3028 } |
|
3029 |
|
3030 var content = Object(external_this_wp_blocks_["serialize"])(blocksForSerialization); // For compatibility, treat a post consisting of a |
|
3031 // single freeform block as legacy content and apply |
|
3032 // pre-block-editor removep'd content formatting. |
|
3033 |
|
3034 if (blocksForSerialization.length === 1 && blocksForSerialization[0].name === Object(external_this_wp_blocks_["getFreeformContentHandlerName"])()) { |
|
3035 content = Object(external_this_wp_autop_["removep"])(content); |
|
3036 } |
|
3037 |
|
3038 return content; |
|
3039 }, { |
|
3040 maxSize: 1 |
|
3041 }); |
|
3042 /* harmony default export */ var serialize_blocks = (serializeBlocks); |
|
3043 |
|
4402 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js |
3044 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js |
4403 |
3045 |
4404 |
3046 |
4405 |
3047 |
4406 |
3048 |
4407 var _marked = |
3049 function actions_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
4408 /*#__PURE__*/ |
3050 |
4409 regenerator_default.a.mark(savePost), |
3051 function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actions_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
4410 _marked2 = |
3052 |
4411 /*#__PURE__*/ |
3053 var _marked = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(setupEditor), |
4412 regenerator_default.a.mark(refreshPost), |
3054 _marked2 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(resetAutosave), |
4413 _marked3 = |
3055 _marked3 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_editPost), |
4414 /*#__PURE__*/ |
3056 _marked4 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_savePost), |
4415 regenerator_default.a.mark(trashPost), |
3057 _marked5 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(refreshPost), |
4416 _marked4 = |
3058 _marked6 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(trashPost), |
4417 /*#__PURE__*/ |
3059 _marked7 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_autosave), |
4418 regenerator_default.a.mark(actions_autosave); |
3060 _marked8 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_experimentalLocalAutosave), |
3061 _marked9 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_redo), |
|
3062 _marked10 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_undo), |
|
3063 _marked11 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_resetEditorBlocks); |
|
4419 |
3064 |
4420 /** |
3065 /** |
4421 * External dependencies |
3066 * External dependencies |
4422 */ |
3067 */ |
4423 |
3068 |
3069 /** |
|
3070 * WordPress dependencies |
|
3071 */ |
|
3072 |
|
3073 |
|
3074 |
|
4424 |
3075 |
4425 /** |
3076 /** |
4426 * Internal dependencies |
3077 * Internal dependencies |
4427 */ |
3078 */ |
4428 |
3079 |
4429 |
3080 |
4430 |
3081 |
4431 |
3082 |
4432 /** |
3083 /** |
4433 * Returns an action object used in signalling that editor has initialized with |
3084 * Returns an action generator used in signalling that editor has initialized with |
4434 * the specified post object and editor settings. |
3085 * the specified post object and editor settings. |
4435 * |
3086 * |
4436 * @param {Object} post Post object. |
3087 * @param {Object} post Post object. |
4437 * @param {Object} edits Initial edited attributes object. |
3088 * @param {Object} edits Initial edited attributes object. |
4438 * @param {Array?} template Block Template. |
3089 * @param {Array?} template Block Template. |
3090 */ |
|
3091 |
|
3092 function setupEditor(post, edits, template) { |
|
3093 var content, blocks, isNewPost; |
|
3094 return external_this_regeneratorRuntime_default.a.wrap(function setupEditor$(_context) { |
|
3095 while (1) { |
|
3096 switch (_context.prev = _context.next) { |
|
3097 case 0: |
|
3098 // In order to ensure maximum of a single parse during setup, edits are |
|
3099 // included as part of editor setup action. Assume edited content as |
|
3100 // canonical if provided, falling back to post. |
|
3101 if (Object(external_this_lodash_["has"])(edits, ['content'])) { |
|
3102 content = edits.content; |
|
3103 } else { |
|
3104 content = post.content.raw; |
|
3105 } |
|
3106 |
|
3107 blocks = Object(external_this_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists. |
|
3108 |
|
3109 isNewPost = post.status === 'auto-draft'; |
|
3110 |
|
3111 if (isNewPost && template) { |
|
3112 blocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); |
|
3113 } |
|
3114 |
|
3115 _context.next = 6; |
|
3116 return resetPost(post); |
|
3117 |
|
3118 case 6: |
|
3119 _context.next = 8; |
|
3120 return { |
|
3121 type: 'SETUP_EDITOR', |
|
3122 post: post, |
|
3123 edits: edits, |
|
3124 template: template |
|
3125 }; |
|
3126 |
|
3127 case 8: |
|
3128 _context.next = 10; |
|
3129 return actions_resetEditorBlocks(blocks, { |
|
3130 __unstableShouldCreateUndoLevel: false |
|
3131 }); |
|
3132 |
|
3133 case 10: |
|
3134 _context.next = 12; |
|
3135 return setupEditorState(post); |
|
3136 |
|
3137 case 12: |
|
3138 if (!(edits && Object.keys(edits).some(function (key) { |
|
3139 return edits[key] !== (Object(external_this_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]); |
|
3140 }))) { |
|
3141 _context.next = 15; |
|
3142 break; |
|
3143 } |
|
3144 |
|
3145 _context.next = 15; |
|
3146 return actions_editPost(edits); |
|
3147 |
|
3148 case 15: |
|
3149 case "end": |
|
3150 return _context.stop(); |
|
3151 } |
|
3152 } |
|
3153 }, _marked); |
|
3154 } |
|
3155 /** |
|
3156 * Returns an action object signalling that the editor is being destroyed and |
|
3157 * that any necessary state or side-effect cleanup should occur. |
|
4439 * |
3158 * |
4440 * @return {Object} Action object. |
3159 * @return {Object} Action object. |
4441 */ |
3160 */ |
4442 |
3161 |
4443 function setupEditor(post, edits, template) { |
3162 function __experimentalTearDownEditor() { |
4444 return { |
3163 return { |
4445 type: 'SETUP_EDITOR', |
3164 type: 'TEAR_DOWN_EDITOR' |
4446 post: post, |
|
4447 edits: edits, |
|
4448 template: template |
|
4449 }; |
3165 }; |
4450 } |
3166 } |
4451 /** |
3167 /** |
4452 * Returns an action object used in signalling that the latest version of the |
3168 * Returns an action object used in signalling that the latest version of the |
4453 * post has been received, either by initialization or save. |
3169 * post has been received, either by initialization or save. |
4465 } |
3181 } |
4466 /** |
3182 /** |
4467 * Returns an action object used in signalling that the latest autosave of the |
3183 * Returns an action object used in signalling that the latest autosave of the |
4468 * post has been received, by initialization or autosave. |
3184 * post has been received, by initialization or autosave. |
4469 * |
3185 * |
4470 * @param {Object} post Autosave post object. |
3186 * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )` |
3187 * selector from the '@wordpress/core-data' package. |
|
3188 * |
|
3189 * @param {Object} newAutosave Autosave post object. |
|
4471 * |
3190 * |
4472 * @return {Object} Action object. |
3191 * @return {Object} Action object. |
4473 */ |
3192 */ |
4474 |
3193 |
4475 function resetAutosave(post) { |
3194 function resetAutosave(newAutosave) { |
4476 return { |
3195 var postId; |
4477 type: 'RESET_AUTOSAVE', |
3196 return external_this_regeneratorRuntime_default.a.wrap(function resetAutosave$(_context2) { |
4478 post: post |
3197 while (1) { |
4479 }; |
3198 switch (_context2.prev = _context2.next) { |
4480 } |
3199 case 0: |
4481 /** |
3200 external_this_wp_deprecated_default()('resetAutosave action (`core/editor` store)', { |
4482 * Optimistic action for dispatching that a post update request has started. |
3201 alternative: 'receiveAutosaves action (`core` store)', |
3202 plugin: 'Gutenberg' |
|
3203 }); |
|
3204 _context2.next = 3; |
|
3205 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostId'); |
|
3206 |
|
3207 case 3: |
|
3208 postId = _context2.sent; |
|
3209 _context2.next = 6; |
|
3210 return Object(external_this_wp_dataControls_["dispatch"])('core', 'receiveAutosaves', postId, newAutosave); |
|
3211 |
|
3212 case 6: |
|
3213 return _context2.abrupt("return", { |
|
3214 type: '__INERT__' |
|
3215 }); |
|
3216 |
|
3217 case 7: |
|
3218 case "end": |
|
3219 return _context2.stop(); |
|
3220 } |
|
3221 } |
|
3222 }, _marked2); |
|
3223 } |
|
3224 /** |
|
3225 * Action for dispatching that a post update request has started. |
|
4483 * |
3226 * |
4484 * @param {Object} options |
3227 * @param {Object} options |
4485 * |
3228 * |
4486 * @return {Object} An action object |
3229 * @return {Object} An action object |
4487 */ |
3230 */ |
4488 |
3231 |
4489 function __experimentalRequestPostUpdateStart() { |
3232 function __experimentalRequestPostUpdateStart() { |
4490 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
3233 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
4491 return { |
3234 return { |
4492 type: 'REQUEST_POST_UPDATE_START', |
3235 type: 'REQUEST_POST_UPDATE_START', |
4493 optimist: { |
|
4494 type: redux_optimist["BEGIN"], |
|
4495 id: POST_UPDATE_TRANSACTION_ID |
|
4496 }, |
|
4497 options: options |
3236 options: options |
4498 }; |
3237 }; |
4499 } |
3238 } |
4500 /** |
3239 /** |
4501 * Optimistic action for indicating that the request post update has completed |
3240 * Action for dispatching that a post update request has finished. |
4502 * successfully. |
3241 * |
4503 * |
3242 * @param {Object} options |
4504 * @param {Object} data The data for the action. |
3243 * |
4505 * @param {Object} data.previousPost The previous post prior to update. |
3244 * @return {Object} An action object |
4506 * @param {Object} data.post The new post after update |
3245 */ |
4507 * @param {boolean} data.isRevision Whether the post is a revision or not. |
3246 |
4508 * @param {Object} data.options Options passed through from the original |
3247 function __experimentalRequestPostUpdateFinish() { |
4509 * action dispatch. |
3248 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
4510 * @param {Object} data.postType The post type object. |
|
4511 * |
|
4512 * @return {Object} Action object. |
|
4513 */ |
|
4514 |
|
4515 function __experimentalRequestPostUpdateSuccess(_ref) { |
|
4516 var previousPost = _ref.previousPost, |
|
4517 post = _ref.post, |
|
4518 isRevision = _ref.isRevision, |
|
4519 options = _ref.options, |
|
4520 postType = _ref.postType; |
|
4521 return { |
3249 return { |
4522 type: 'REQUEST_POST_UPDATE_SUCCESS', |
3250 type: 'REQUEST_POST_UPDATE_FINISH', |
4523 previousPost: previousPost, |
|
4524 post: post, |
|
4525 optimist: { |
|
4526 // Note: REVERT is not a failure case here. Rather, it |
|
4527 // is simply reversing the assumption that the updates |
|
4528 // were applied to the post proper, such that the post |
|
4529 // treated as having unsaved changes. |
|
4530 type: isRevision ? redux_optimist["REVERT"] : redux_optimist["COMMIT"], |
|
4531 id: POST_UPDATE_TRANSACTION_ID |
|
4532 }, |
|
4533 options: options, |
|
4534 postType: postType |
|
4535 }; |
|
4536 } |
|
4537 /** |
|
4538 * Optimistic action for indicating that the request post update has completed |
|
4539 * with a failure. |
|
4540 * |
|
4541 * @param {Object} data The data for the action |
|
4542 * @param {Object} data.post The post that failed updating. |
|
4543 * @param {Object} data.edits The fields that were being updated. |
|
4544 * @param {*} data.error The error from the failed call. |
|
4545 * @param {Object} data.options Options passed through from the original |
|
4546 * action dispatch. |
|
4547 * @return {Object} An action object |
|
4548 */ |
|
4549 |
|
4550 function __experimentalRequestPostUpdateFailure(_ref2) { |
|
4551 var post = _ref2.post, |
|
4552 edits = _ref2.edits, |
|
4553 error = _ref2.error, |
|
4554 options = _ref2.options; |
|
4555 return { |
|
4556 type: 'REQUEST_POST_UPDATE_FAILURE', |
|
4557 optimist: { |
|
4558 type: redux_optimist["REVERT"], |
|
4559 id: POST_UPDATE_TRANSACTION_ID |
|
4560 }, |
|
4561 post: post, |
|
4562 edits: edits, |
|
4563 error: error, |
|
4564 options: options |
3251 options: options |
4565 }; |
3252 }; |
4566 } |
3253 } |
4567 /** |
3254 /** |
4568 * Returns an action object used in signalling that a patch of updates for the |
3255 * Returns an action object used in signalling that a patch of updates for the |
4596 } |
3283 } |
4597 /** |
3284 /** |
4598 * Returns an action object used in signalling that attributes of the post have |
3285 * Returns an action object used in signalling that attributes of the post have |
4599 * been edited. |
3286 * been edited. |
4600 * |
3287 * |
4601 * @param {Object} edits Post attributes to edit. |
3288 * @param {Object} edits Post attributes to edit. |
4602 * |
3289 * @param {Object} options Options for the edit. |
4603 * @return {Object} Action object. |
3290 * |
4604 */ |
3291 * @yield {Object} Action object or control. |
4605 |
3292 */ |
4606 function actions_editPost(edits) { |
3293 |
4607 return { |
3294 function actions_editPost(edits, options) { |
4608 type: 'EDIT_POST', |
3295 var _yield$select, id, type; |
4609 edits: edits |
3296 |
4610 }; |
3297 return external_this_regeneratorRuntime_default.a.wrap(function editPost$(_context3) { |
3298 while (1) { |
|
3299 switch (_context3.prev = _context3.next) { |
|
3300 case 0: |
|
3301 _context3.next = 2; |
|
3302 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
|
3303 |
|
3304 case 2: |
|
3305 _yield$select = _context3.sent; |
|
3306 id = _yield$select.id; |
|
3307 type = _yield$select.type; |
|
3308 _context3.next = 7; |
|
3309 return Object(external_this_wp_dataControls_["dispatch"])('core', 'editEntityRecord', 'postType', type, id, edits, options); |
|
3310 |
|
3311 case 7: |
|
3312 case "end": |
|
3313 return _context3.stop(); |
|
3314 } |
|
3315 } |
|
3316 }, _marked3); |
|
4611 } |
3317 } |
4612 /** |
3318 /** |
4613 * Returns action object produced by the updatePost creator augmented by |
3319 * Returns action object produced by the updatePost creator augmented by |
4614 * an optimist option that signals optimistically applying updates. |
3320 * an optimist option that signals optimistically applying updates. |
4615 * |
3321 * |
4617 * |
3323 * |
4618 * @return {Object} Action object. |
3324 * @return {Object} Action object. |
4619 */ |
3325 */ |
4620 |
3326 |
4621 function __experimentalOptimisticUpdatePost(edits) { |
3327 function __experimentalOptimisticUpdatePost(edits) { |
4622 return Object(objectSpread["a" /* default */])({}, updatePost(edits), { |
3328 return actions_objectSpread({}, updatePost(edits), { |
4623 optimist: { |
3329 optimist: { |
4624 id: POST_UPDATE_TRANSACTION_ID |
3330 id: POST_UPDATE_TRANSACTION_ID |
4625 } |
3331 } |
4626 }); |
3332 }); |
4627 } |
3333 } |
4629 * Action generator for saving the current post in the editor. |
3335 * Action generator for saving the current post in the editor. |
4630 * |
3336 * |
4631 * @param {Object} options |
3337 * @param {Object} options |
4632 */ |
3338 */ |
4633 |
3339 |
4634 function savePost() { |
3340 function actions_savePost() { |
4635 var options, |
3341 var options, |
4636 isEditedPostSaveable, |
|
4637 edits, |
3342 edits, |
4638 isAutosave, |
3343 previousRecord, |
4639 isEditedPostNew, |
3344 error, |
4640 post, |
3345 args, |
4641 editedPostContent, |
3346 updatedRecord, |
4642 toSend, |
3347 _args4, |
4643 currentPostType, |
3348 _args5 = arguments; |
4644 postType, |
3349 |
4645 path, |
3350 return external_this_regeneratorRuntime_default.a.wrap(function savePost$(_context4) { |
4646 method, |
|
4647 autoSavePost, |
|
4648 newPost, |
|
4649 resetAction, |
|
4650 notifySuccessArgs, |
|
4651 notifyFailArgs, |
|
4652 _args = arguments; |
|
4653 return regenerator_default.a.wrap(function savePost$(_context) { |
|
4654 while (1) { |
3351 while (1) { |
4655 switch (_context.prev = _context.next) { |
3352 switch (_context4.prev = _context4.next) { |
4656 case 0: |
3353 case 0: |
4657 options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}; |
3354 options = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}; |
4658 _context.next = 3; |
3355 _context4.next = 3; |
4659 return controls_select(STORE_KEY, 'isEditedPostSaveable'); |
3356 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'isEditedPostSaveable'); |
4660 |
3357 |
4661 case 3: |
3358 case 3: |
4662 isEditedPostSaveable = _context.sent; |
3359 if (_context4.sent) { |
4663 |
3360 _context4.next = 5; |
4664 if (isEditedPostSaveable) { |
|
4665 _context.next = 6; |
|
4666 break; |
3361 break; |
4667 } |
3362 } |
4668 |
3363 |
4669 return _context.abrupt("return"); |
3364 return _context4.abrupt("return"); |
4670 |
3365 |
4671 case 6: |
3366 case 5: |
4672 _context.next = 8; |
3367 _context4.next = 7; |
4673 return controls_select(STORE_KEY, 'getPostEdits'); |
3368 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostContent'); |
4674 |
3369 |
4675 case 8: |
3370 case 7: |
4676 edits = _context.sent; |
3371 _context4.t0 = _context4.sent; |
4677 isAutosave = !!options.isAutosave; |
3372 edits = { |
4678 |
3373 content: _context4.t0 |
4679 if (isAutosave) { |
3374 }; |
4680 edits = Object(external_lodash_["pick"])(edits, ['title', 'content', 'excerpt']); |
3375 |
4681 } |
3376 if (options.isAutosave) { |
4682 |
3377 _context4.next = 12; |
4683 _context.next = 13; |
|
4684 return controls_select(STORE_KEY, 'isEditedPostNew'); |
|
4685 |
|
4686 case 13: |
|
4687 isEditedPostNew = _context.sent; |
|
4688 |
|
4689 // New posts (with auto-draft status) must be explicitly assigned draft |
|
4690 // status if there is not already a status assigned in edits (publish). |
|
4691 // Otherwise, they are wrongly left as auto-draft. Status is not always |
|
4692 // respected for autosaves, so it cannot simply be included in the pick |
|
4693 // above. This behavior relies on an assumption that an auto-draft post |
|
4694 // would never be saved by anyone other than the owner of the post, per |
|
4695 // logic within autosaves REST controller to save status field only for |
|
4696 // draft/auto-draft by current user. |
|
4697 // |
|
4698 // See: https://core.trac.wordpress.org/ticket/43316#comment:88 |
|
4699 // See: https://core.trac.wordpress.org/ticket/43316#comment:89 |
|
4700 if (isEditedPostNew) { |
|
4701 edits = Object(objectSpread["a" /* default */])({ |
|
4702 status: 'draft' |
|
4703 }, edits); |
|
4704 } |
|
4705 |
|
4706 _context.next = 17; |
|
4707 return controls_select(STORE_KEY, 'getCurrentPost'); |
|
4708 |
|
4709 case 17: |
|
4710 post = _context.sent; |
|
4711 _context.next = 20; |
|
4712 return controls_select(STORE_KEY, 'getEditedPostContent'); |
|
4713 |
|
4714 case 20: |
|
4715 editedPostContent = _context.sent; |
|
4716 toSend = Object(objectSpread["a" /* default */])({}, edits, { |
|
4717 content: editedPostContent, |
|
4718 id: post.id |
|
4719 }); |
|
4720 _context.next = 24; |
|
4721 return controls_select(STORE_KEY, 'getCurrentPostType'); |
|
4722 |
|
4723 case 24: |
|
4724 currentPostType = _context.sent; |
|
4725 _context.next = 27; |
|
4726 return resolveSelect('core', 'getPostType', currentPostType); |
|
4727 |
|
4728 case 27: |
|
4729 postType = _context.sent; |
|
4730 _context.next = 30; |
|
4731 return controls_dispatch(STORE_KEY, '__experimentalRequestPostUpdateStart', options); |
|
4732 |
|
4733 case 30: |
|
4734 _context.next = 32; |
|
4735 return controls_dispatch(STORE_KEY, '__experimentalOptimisticUpdatePost', toSend); |
|
4736 |
|
4737 case 32: |
|
4738 path = "/wp/v2/".concat(postType.rest_base, "/").concat(post.id); |
|
4739 method = 'PUT'; |
|
4740 |
|
4741 if (!isAutosave) { |
|
4742 _context.next = 43; |
|
4743 break; |
3378 break; |
4744 } |
3379 } |
4745 |
3380 |
4746 _context.next = 37; |
3381 _context4.next = 12; |
4747 return controls_select(STORE_KEY, 'getAutosave'); |
3382 return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'editPost', edits, { |
4748 |
3383 undoIgnore: true |
4749 case 37: |
|
4750 autoSavePost = _context.sent; |
|
4751 // Ensure autosaves contain all expected fields, using autosave or |
|
4752 // post values as fallback if not otherwise included in edits. |
|
4753 toSend = Object(objectSpread["a" /* default */])({}, Object(external_lodash_["pick"])(post, ['title', 'content', 'excerpt']), autoSavePost, toSend); |
|
4754 path += '/autosaves'; |
|
4755 method = 'POST'; |
|
4756 _context.next = 47; |
|
4757 break; |
|
4758 |
|
4759 case 43: |
|
4760 _context.next = 45; |
|
4761 return controls_dispatch('core/notices', 'removeNotice', SAVE_POST_NOTICE_ID); |
|
4762 |
|
4763 case 45: |
|
4764 _context.next = 47; |
|
4765 return controls_dispatch('core/notices', 'removeNotice', 'autosave-exists'); |
|
4766 |
|
4767 case 47: |
|
4768 _context.prev = 47; |
|
4769 _context.next = 50; |
|
4770 return apiFetch({ |
|
4771 path: path, |
|
4772 method: method, |
|
4773 data: toSend |
|
4774 }); |
3384 }); |
4775 |
3385 |
4776 case 50: |
3386 case 12: |
4777 newPost = _context.sent; |
3387 _context4.next = 14; |
4778 resetAction = isAutosave ? 'resetAutosave' : 'resetPost'; |
3388 return __experimentalRequestPostUpdateStart(options); |
4779 _context.next = 54; |
3389 |
4780 return controls_dispatch(STORE_KEY, resetAction, newPost); |
3390 case 14: |
4781 |
3391 _context4.next = 16; |
4782 case 54: |
3392 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
4783 _context.next = 56; |
3393 |
4784 return controls_dispatch(STORE_KEY, '__experimentalRequestPostUpdateSuccess', { |
3394 case 16: |
4785 previousPost: post, |
3395 previousRecord = _context4.sent; |
4786 post: newPost, |
3396 _context4.t1 = actions_objectSpread; |
4787 options: options, |
3397 _context4.t2 = { |
4788 postType: postType, |
3398 id: previousRecord.id |
4789 // An autosave may be processed by the server as a regular save |
3399 }; |
4790 // when its update is requested by the author and the post was |
3400 _context4.next = 21; |
4791 // draft or auto-draft. |
3401 return Object(external_this_wp_dataControls_["select"])('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id); |
4792 isRevision: newPost.id !== post.id |
3402 |
4793 }); |
3403 case 21: |
4794 |
3404 _context4.t3 = _context4.sent; |
4795 case 56: |
3405 _context4.t4 = {}; |
4796 notifySuccessArgs = getNotificationArgumentsForSaveSuccess({ |
3406 _context4.t5 = edits; |
4797 previousPost: post, |
3407 edits = (0, _context4.t1)(_context4.t2, _context4.t3, _context4.t4, _context4.t5); |
4798 post: newPost, |
3408 _context4.next = 27; |
4799 postType: postType, |
3409 return Object(external_this_wp_dataControls_["dispatch"])('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options); |
4800 options: options |
3410 |
4801 }); |
3411 case 27: |
4802 |
3412 _context4.next = 29; |
4803 if (!(notifySuccessArgs.length > 0)) { |
3413 return __experimentalRequestPostUpdateFinish(options); |
4804 _context.next = 60; |
3414 |
3415 case 29: |
|
3416 _context4.next = 31; |
|
3417 return Object(external_this_wp_dataControls_["select"])('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id); |
|
3418 |
|
3419 case 31: |
|
3420 error = _context4.sent; |
|
3421 |
|
3422 if (!error) { |
|
3423 _context4.next = 39; |
|
4805 break; |
3424 break; |
4806 } |
3425 } |
4807 |
3426 |
4808 _context.next = 60; |
3427 args = getNotificationArgumentsForSaveFail({ |
4809 return controls_dispatch.apply(void 0, ['core/notices', 'createSuccessNotice'].concat(Object(toConsumableArray["a" /* default */])(notifySuccessArgs))); |
3428 post: previousRecord, |
4810 |
|
4811 case 60: |
|
4812 _context.next = 70; |
|
4813 break; |
|
4814 |
|
4815 case 62: |
|
4816 _context.prev = 62; |
|
4817 _context.t0 = _context["catch"](47); |
|
4818 _context.next = 66; |
|
4819 return controls_dispatch(STORE_KEY, '__experimentalRequestPostUpdateFailure', { |
|
4820 post: post, |
|
4821 edits: edits, |
3429 edits: edits, |
4822 error: _context.t0, |
3430 error: error |
4823 options: options |
|
4824 }); |
3431 }); |
4825 |
3432 |
4826 case 66: |
3433 if (!args.length) { |
4827 notifyFailArgs = getNotificationArgumentsForSaveFail({ |
3434 _context4.next = 37; |
4828 post: post, |
|
4829 edits: edits, |
|
4830 error: _context.t0 |
|
4831 }); |
|
4832 |
|
4833 if (!(notifyFailArgs.length > 0)) { |
|
4834 _context.next = 70; |
|
4835 break; |
3435 break; |
4836 } |
3436 } |
4837 |
3437 |
4838 _context.next = 70; |
3438 _context4.next = 37; |
4839 return controls_dispatch.apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(notifyFailArgs))); |
3439 return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(args))); |
4840 |
3440 |
4841 case 70: |
3441 case 37: |
3442 _context4.next = 57; |
|
3443 break; |
|
3444 |
|
3445 case 39: |
|
3446 _context4.next = 41; |
|
3447 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
|
3448 |
|
3449 case 41: |
|
3450 updatedRecord = _context4.sent; |
|
3451 _context4.t6 = getNotificationArgumentsForSaveSuccess; |
|
3452 _context4.t7 = previousRecord; |
|
3453 _context4.t8 = updatedRecord; |
|
3454 _context4.next = 47; |
|
3455 return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', updatedRecord.type); |
|
3456 |
|
3457 case 47: |
|
3458 _context4.t9 = _context4.sent; |
|
3459 _context4.t10 = options; |
|
3460 _context4.t11 = { |
|
3461 previousPost: _context4.t7, |
|
3462 post: _context4.t8, |
|
3463 postType: _context4.t9, |
|
3464 options: _context4.t10 |
|
3465 }; |
|
3466 _args4 = (0, _context4.t6)(_context4.t11); |
|
3467 |
|
3468 if (!_args4.length) { |
|
3469 _context4.next = 54; |
|
3470 break; |
|
3471 } |
|
3472 |
|
3473 _context4.next = 54; |
|
3474 return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createSuccessNotice'].concat(Object(toConsumableArray["a" /* default */])(_args4))); |
|
3475 |
|
3476 case 54: |
|
3477 if (options.isAutosave) { |
|
3478 _context4.next = 57; |
|
3479 break; |
|
3480 } |
|
3481 |
|
3482 _context4.next = 57; |
|
3483 return Object(external_this_wp_dataControls_["dispatch"])('core/block-editor', '__unstableMarkLastChangeAsPersistent'); |
|
3484 |
|
3485 case 57: |
|
4842 case "end": |
3486 case "end": |
4843 return _context.stop(); |
3487 return _context4.stop(); |
4844 } |
3488 } |
4845 } |
3489 } |
4846 }, _marked, this, [[47, 62]]); |
3490 }, _marked4); |
4847 } |
3491 } |
4848 /** |
3492 /** |
4849 * Action generator for handling refreshing the current post. |
3493 * Action generator for handling refreshing the current post. |
4850 */ |
3494 */ |
4851 |
3495 |
4852 function refreshPost() { |
3496 function refreshPost() { |
4853 var post, postTypeSlug, postType, newPost; |
3497 var post, postTypeSlug, postType, newPost; |
4854 return regenerator_default.a.wrap(function refreshPost$(_context2) { |
3498 return external_this_regeneratorRuntime_default.a.wrap(function refreshPost$(_context5) { |
4855 while (1) { |
3499 while (1) { |
4856 switch (_context2.prev = _context2.next) { |
3500 switch (_context5.prev = _context5.next) { |
4857 case 0: |
3501 case 0: |
4858 _context2.next = 2; |
3502 _context5.next = 2; |
4859 return controls_select(STORE_KEY, 'getCurrentPost'); |
3503 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
4860 |
3504 |
4861 case 2: |
3505 case 2: |
4862 post = _context2.sent; |
3506 post = _context5.sent; |
4863 _context2.next = 5; |
3507 _context5.next = 5; |
4864 return controls_select(STORE_KEY, 'getCurrentPostType'); |
3508 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostType'); |
4865 |
3509 |
4866 case 5: |
3510 case 5: |
4867 postTypeSlug = _context2.sent; |
3511 postTypeSlug = _context5.sent; |
4868 _context2.next = 8; |
3512 _context5.next = 8; |
4869 return resolveSelect('core', 'getPostType', postTypeSlug); |
3513 return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', postTypeSlug); |
4870 |
3514 |
4871 case 8: |
3515 case 8: |
4872 postType = _context2.sent; |
3516 postType = _context5.sent; |
4873 _context2.next = 11; |
3517 _context5.next = 11; |
4874 return apiFetch({ |
3518 return Object(external_this_wp_dataControls_["apiFetch"])({ |
4875 // Timestamp arg allows caller to bypass browser caching, which is |
3519 // Timestamp arg allows caller to bypass browser caching, which is |
4876 // expected for this specific function. |
3520 // expected for this specific function. |
4877 path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id) + "?context=edit&_timestamp=".concat(Date.now()) |
3521 path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id) + "?context=edit&_timestamp=".concat(Date.now()) |
4878 }); |
3522 }); |
4879 |
3523 |
4880 case 11: |
3524 case 11: |
4881 newPost = _context2.sent; |
3525 newPost = _context5.sent; |
4882 _context2.next = 14; |
3526 _context5.next = 14; |
4883 return controls_dispatch(STORE_KEY, 'resetPost', newPost); |
3527 return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'resetPost', newPost); |
4884 |
3528 |
4885 case 14: |
3529 case 14: |
4886 case "end": |
3530 case "end": |
4887 return _context2.stop(); |
3531 return _context5.stop(); |
4888 } |
3532 } |
4889 } |
3533 } |
4890 }, _marked2, this); |
3534 }, _marked5); |
4891 } |
3535 } |
4892 /** |
3536 /** |
4893 * Action generator for trashing the current post in the editor. |
3537 * Action generator for trashing the current post in the editor. |
4894 */ |
3538 */ |
4895 |
3539 |
4896 function trashPost() { |
3540 function trashPost() { |
4897 var postTypeSlug, postType, post; |
3541 var postTypeSlug, postType, post; |
4898 return regenerator_default.a.wrap(function trashPost$(_context3) { |
3542 return external_this_regeneratorRuntime_default.a.wrap(function trashPost$(_context6) { |
4899 while (1) { |
3543 while (1) { |
4900 switch (_context3.prev = _context3.next) { |
3544 switch (_context6.prev = _context6.next) { |
4901 case 0: |
3545 case 0: |
4902 _context3.next = 2; |
3546 _context6.next = 2; |
4903 return controls_select(STORE_KEY, 'getCurrentPostType'); |
3547 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostType'); |
4904 |
3548 |
4905 case 2: |
3549 case 2: |
4906 postTypeSlug = _context3.sent; |
3550 postTypeSlug = _context6.sent; |
4907 _context3.next = 5; |
3551 _context6.next = 5; |
4908 return resolveSelect('core', 'getPostType', postTypeSlug); |
3552 return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', postTypeSlug); |
4909 |
3553 |
4910 case 5: |
3554 case 5: |
4911 postType = _context3.sent; |
3555 postType = _context6.sent; |
4912 _context3.next = 8; |
3556 _context6.next = 8; |
4913 return controls_dispatch('core/notices', 'removeNotice', TRASH_POST_NOTICE_ID); |
3557 return Object(external_this_wp_dataControls_["dispatch"])('core/notices', 'removeNotice', TRASH_POST_NOTICE_ID); |
4914 |
3558 |
4915 case 8: |
3559 case 8: |
4916 _context3.prev = 8; |
3560 _context6.prev = 8; |
4917 _context3.next = 11; |
3561 _context6.next = 11; |
4918 return controls_select(STORE_KEY, 'getCurrentPost'); |
3562 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
4919 |
3563 |
4920 case 11: |
3564 case 11: |
4921 post = _context3.sent; |
3565 post = _context6.sent; |
4922 _context3.next = 14; |
3566 _context6.next = 14; |
4923 return apiFetch({ |
3567 return Object(external_this_wp_dataControls_["apiFetch"])({ |
4924 path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id), |
3568 path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id), |
4925 method: 'DELETE' |
3569 method: 'DELETE' |
4926 }); |
3570 }); |
4927 |
3571 |
4928 case 14: |
3572 case 14: |
4929 _context3.next = 16; |
3573 _context6.next = 16; |
4930 return controls_dispatch(STORE_KEY, 'resetPost', Object(objectSpread["a" /* default */])({}, post, { |
3574 return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'savePost'); |
4931 status: 'trash' |
|
4932 })); |
|
4933 |
3575 |
4934 case 16: |
3576 case 16: |
4935 _context3.next = 22; |
3577 _context6.next = 22; |
4936 break; |
3578 break; |
4937 |
3579 |
4938 case 18: |
3580 case 18: |
4939 _context3.prev = 18; |
3581 _context6.prev = 18; |
4940 _context3.t0 = _context3["catch"](8); |
3582 _context6.t0 = _context6["catch"](8); |
4941 _context3.next = 22; |
3583 _context6.next = 22; |
4942 return controls_dispatch.apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(getNotificationArgumentsForTrashFail({ |
3584 return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(getNotificationArgumentsForTrashFail({ |
4943 error: _context3.t0 |
3585 error: _context6.t0 |
4944 })))); |
3586 })))); |
4945 |
3587 |
4946 case 22: |
3588 case 22: |
4947 case "end": |
3589 case "end": |
4948 return _context3.stop(); |
3590 return _context6.stop(); |
4949 } |
3591 } |
4950 } |
3592 } |
4951 }, _marked3, this, [[8, 18]]); |
3593 }, _marked6, null, [[8, 18]]); |
4952 } |
3594 } |
4953 /** |
3595 /** |
4954 * Action generator used in signalling that the post should autosave. |
3596 * Action generator used in signalling that the post should autosave. |
4955 * |
3597 * |
4956 * @param {Object?} options Extra flags to identify the autosave. |
3598 * @param {Object?} options Extra flags to identify the autosave. |
4957 */ |
3599 */ |
4958 |
3600 |
4959 function actions_autosave(options) { |
3601 function actions_autosave(options) { |
4960 return regenerator_default.a.wrap(function autosave$(_context4) { |
3602 return external_this_regeneratorRuntime_default.a.wrap(function autosave$(_context7) { |
4961 while (1) { |
3603 while (1) { |
4962 switch (_context4.prev = _context4.next) { |
3604 switch (_context7.prev = _context7.next) { |
4963 case 0: |
3605 case 0: |
4964 _context4.next = 2; |
3606 _context7.next = 2; |
4965 return controls_dispatch(STORE_KEY, 'savePost', Object(objectSpread["a" /* default */])({ |
3607 return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'savePost', actions_objectSpread({ |
4966 isAutosave: true |
3608 isAutosave: true |
4967 }, options)); |
3609 }, options)); |
4968 |
3610 |
4969 case 2: |
3611 case 2: |
4970 case "end": |
3612 case "end": |
4971 return _context4.stop(); |
3613 return _context7.stop(); |
4972 } |
3614 } |
4973 } |
3615 } |
4974 }, _marked4, this); |
3616 }, _marked7); |
3617 } |
|
3618 function actions_experimentalLocalAutosave() { |
|
3619 var post, title, content, excerpt; |
|
3620 return external_this_regeneratorRuntime_default.a.wrap(function __experimentalLocalAutosave$(_context8) { |
|
3621 while (1) { |
|
3622 switch (_context8.prev = _context8.next) { |
|
3623 case 0: |
|
3624 _context8.next = 2; |
|
3625 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
|
3626 |
|
3627 case 2: |
|
3628 post = _context8.sent; |
|
3629 _context8.next = 5; |
|
3630 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'title'); |
|
3631 |
|
3632 case 5: |
|
3633 title = _context8.sent; |
|
3634 _context8.next = 8; |
|
3635 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'content'); |
|
3636 |
|
3637 case 8: |
|
3638 content = _context8.sent; |
|
3639 _context8.next = 11; |
|
3640 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'excerpt'); |
|
3641 |
|
3642 case 11: |
|
3643 excerpt = _context8.sent; |
|
3644 _context8.next = 14; |
|
3645 return { |
|
3646 type: 'LOCAL_AUTOSAVE_SET', |
|
3647 postId: post.id, |
|
3648 title: title, |
|
3649 content: content, |
|
3650 excerpt: excerpt |
|
3651 }; |
|
3652 |
|
3653 case 14: |
|
3654 case "end": |
|
3655 return _context8.stop(); |
|
3656 } |
|
3657 } |
|
3658 }, _marked8); |
|
4975 } |
3659 } |
4976 /** |
3660 /** |
4977 * Returns an action object used in signalling that undo history should |
3661 * Returns an action object used in signalling that undo history should |
4978 * restore last popped state. |
3662 * restore last popped state. |
4979 * |
3663 * |
4980 * @return {Object} Action object. |
3664 * @yield {Object} Action object. |
4981 */ |
3665 */ |
4982 |
3666 |
4983 function actions_redo() { |
3667 function actions_redo() { |
4984 return { |
3668 return external_this_regeneratorRuntime_default.a.wrap(function redo$(_context9) { |
4985 type: 'REDO' |
3669 while (1) { |
4986 }; |
3670 switch (_context9.prev = _context9.next) { |
3671 case 0: |
|
3672 _context9.next = 2; |
|
3673 return Object(external_this_wp_dataControls_["dispatch"])('core', 'redo'); |
|
3674 |
|
3675 case 2: |
|
3676 case "end": |
|
3677 return _context9.stop(); |
|
3678 } |
|
3679 } |
|
3680 }, _marked9); |
|
4987 } |
3681 } |
4988 /** |
3682 /** |
4989 * Returns an action object used in signalling that undo history should pop. |
3683 * Returns an action object used in signalling that undo history should pop. |
4990 * |
3684 * |
4991 * @return {Object} Action object. |
3685 * @yield {Object} Action object. |
4992 */ |
3686 */ |
4993 |
3687 |
4994 function actions_undo() { |
3688 function actions_undo() { |
4995 return { |
3689 return external_this_regeneratorRuntime_default.a.wrap(function undo$(_context10) { |
4996 type: 'UNDO' |
3690 while (1) { |
4997 }; |
3691 switch (_context10.prev = _context10.next) { |
3692 case 0: |
|
3693 _context10.next = 2; |
|
3694 return Object(external_this_wp_dataControls_["dispatch"])('core', 'undo'); |
|
3695 |
|
3696 case 2: |
|
3697 case "end": |
|
3698 return _context10.stop(); |
|
3699 } |
|
3700 } |
|
3701 }, _marked10); |
|
4998 } |
3702 } |
4999 /** |
3703 /** |
5000 * Returns an action object used in signalling that undo history record should |
3704 * Returns an action object used in signalling that undo history record should |
5001 * be created. |
3705 * be created. |
5002 * |
3706 * |
5030 * be fetched. |
3734 * be fetched. |
5031 * |
3735 * |
5032 * @return {Object} Action object. |
3736 * @return {Object} Action object. |
5033 */ |
3737 */ |
5034 |
3738 |
5035 function __experimentalFetchReusableBlocks(id) { |
3739 function actions_experimentalFetchReusableBlocks(id) { |
5036 return { |
3740 return { |
5037 type: 'FETCH_REUSABLE_BLOCKS', |
3741 type: 'FETCH_REUSABLE_BLOCKS', |
5038 id: id |
3742 id: id |
5039 }; |
3743 }; |
5040 } |
3744 } |
5083 type: 'DELETE_REUSABLE_BLOCK', |
3787 type: 'DELETE_REUSABLE_BLOCK', |
5084 id: id |
3788 id: id |
5085 }; |
3789 }; |
5086 } |
3790 } |
5087 /** |
3791 /** |
5088 * Returns an action object used in signalling that a reusable block's title is |
3792 * Returns an action object used in signalling that a reusable block is |
5089 * to be updated. |
3793 * to be updated. |
5090 * |
3794 * |
5091 * @param {number} id The ID of the reusable block to update. |
3795 * @param {number} id The ID of the reusable block to update. |
5092 * @param {string} title The new title. |
3796 * @param {Object} changes The changes to apply. |
5093 * |
3797 * |
5094 * @return {Object} Action object. |
3798 * @return {Object} Action object. |
5095 */ |
3799 */ |
5096 |
3800 |
5097 function __experimentalUpdateReusableBlockTitle(id, title) { |
3801 function __experimentalUpdateReusableBlock(id, changes) { |
5098 return { |
3802 return { |
5099 type: 'UPDATE_REUSABLE_BLOCK_TITLE', |
3803 type: 'UPDATE_REUSABLE_BLOCK', |
5100 id: id, |
3804 id: id, |
5101 title: title |
3805 changes: changes |
5102 }; |
3806 }; |
5103 } |
3807 } |
5104 /** |
3808 /** |
5105 * Returns an action object used to convert a reusable block into a static |
3809 * Returns an action object used to convert a reusable block into a static |
5106 * block. |
3810 * block. |
5126 */ |
3830 */ |
5127 |
3831 |
5128 function __experimentalConvertBlockToReusable(clientIds) { |
3832 function __experimentalConvertBlockToReusable(clientIds) { |
5129 return { |
3833 return { |
5130 type: 'CONVERT_BLOCK_TO_REUSABLE', |
3834 type: 'CONVERT_BLOCK_TO_REUSABLE', |
5131 clientIds: Object(external_lodash_["castArray"])(clientIds) |
3835 clientIds: Object(external_this_lodash_["castArray"])(clientIds) |
5132 }; |
3836 }; |
5133 } |
3837 } |
5134 /** |
3838 /** |
5135 * Returns an action object used in signalling that the user has enabled the |
3839 * Returns an action object used in signalling that the user has enabled the |
5136 * publish sidebar. |
3840 * publish sidebar. |
5157 } |
3861 } |
5158 /** |
3862 /** |
5159 * Returns an action object used to signal that post saving is locked. |
3863 * Returns an action object used to signal that post saving is locked. |
5160 * |
3864 * |
5161 * @param {string} lockName The lock name. |
3865 * @param {string} lockName The lock name. |
3866 * |
|
3867 * @example |
|
3868 * ``` |
|
3869 * const { subscribe } = wp.data; |
|
3870 * |
|
3871 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); |
|
3872 * |
|
3873 * // Only allow publishing posts that are set to a future date. |
|
3874 * if ( 'publish' !== initialPostStatus ) { |
|
3875 * |
|
3876 * // Track locking. |
|
3877 * let locked = false; |
|
3878 * |
|
3879 * // Watch for the publish event. |
|
3880 * let unssubscribe = subscribe( () => { |
|
3881 * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); |
|
3882 * if ( 'publish' !== currentPostStatus ) { |
|
3883 * |
|
3884 * // Compare the post date to the current date, lock the post if the date isn't in the future. |
|
3885 * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); |
|
3886 * const currentDate = new Date(); |
|
3887 * if ( postDate.getTime() <= currentDate.getTime() ) { |
|
3888 * if ( ! locked ) { |
|
3889 * locked = true; |
|
3890 * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); |
|
3891 * } |
|
3892 * } else { |
|
3893 * if ( locked ) { |
|
3894 * locked = false; |
|
3895 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); |
|
3896 * } |
|
3897 * } |
|
3898 * } |
|
3899 * } ); |
|
3900 * } |
|
3901 * ``` |
|
5162 * |
3902 * |
5163 * @return {Object} Action object |
3903 * @return {Object} Action object |
5164 */ |
3904 */ |
5165 |
3905 |
5166 function lockPostSaving(lockName) { |
3906 function lockPostSaving(lockName) { |
5172 /** |
3912 /** |
5173 * Returns an action object used to signal that post saving is unlocked. |
3913 * Returns an action object used to signal that post saving is unlocked. |
5174 * |
3914 * |
5175 * @param {string} lockName The lock name. |
3915 * @param {string} lockName The lock name. |
5176 * |
3916 * |
3917 * @example |
|
3918 * ``` |
|
3919 * // Unlock post saving with the lock key `mylock`: |
|
3920 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); |
|
3921 * ``` |
|
3922 * |
|
5177 * @return {Object} Action object |
3923 * @return {Object} Action object |
5178 */ |
3924 */ |
5179 |
3925 |
5180 function unlockPostSaving(lockName) { |
3926 function unlockPostSaving(lockName) { |
5181 return { |
3927 return { |
5182 type: 'UNLOCK_POST_SAVING', |
3928 type: 'UNLOCK_POST_SAVING', |
5183 lockName: lockName |
3929 lockName: lockName |
5184 }; |
3930 }; |
5185 } |
3931 } |
5186 /** |
3932 /** |
3933 * Returns an action object used to signal that post autosaving is locked. |
|
3934 * |
|
3935 * @param {string} lockName The lock name. |
|
3936 * |
|
3937 * @example |
|
3938 * ``` |
|
3939 * // Lock post autosaving with the lock key `mylock`: |
|
3940 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); |
|
3941 * ``` |
|
3942 * |
|
3943 * @return {Object} Action object |
|
3944 */ |
|
3945 |
|
3946 function lockPostAutosaving(lockName) { |
|
3947 return { |
|
3948 type: 'LOCK_POST_AUTOSAVING', |
|
3949 lockName: lockName |
|
3950 }; |
|
3951 } |
|
3952 /** |
|
3953 * Returns an action object used to signal that post autosaving is unlocked. |
|
3954 * |
|
3955 * @param {string} lockName The lock name. |
|
3956 * |
|
3957 * @example |
|
3958 * ``` |
|
3959 * // Unlock post saving with the lock key `mylock`: |
|
3960 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); |
|
3961 * ``` |
|
3962 * |
|
3963 * @return {Object} Action object |
|
3964 */ |
|
3965 |
|
3966 function unlockPostAutosaving(lockName) { |
|
3967 return { |
|
3968 type: 'UNLOCK_POST_AUTOSAVING', |
|
3969 lockName: lockName |
|
3970 }; |
|
3971 } |
|
3972 /** |
|
5187 * Returns an action object used to signal that the blocks have been updated. |
3973 * Returns an action object used to signal that the blocks have been updated. |
5188 * |
3974 * |
5189 * @param {Array} blocks Block Array. |
3975 * @param {Array} blocks Block Array. |
5190 * @param {?Object} options Optional options. |
3976 * @param {?Object} options Optional options. |
5191 * |
3977 * |
5192 * @return {Object} Action object |
3978 * @yield {Object} Action object |
5193 */ |
3979 */ |
5194 |
3980 |
5195 function actions_resetEditorBlocks(blocks) { |
3981 function actions_resetEditorBlocks(blocks) { |
5196 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
3982 var options, |
5197 return { |
3983 __unstableShouldCreateUndoLevel, |
5198 type: 'RESET_EDITOR_BLOCKS', |
3984 selectionStart, |
5199 blocks: blocks, |
3985 selectionEnd, |
5200 shouldCreateUndoLevel: options.__unstableShouldCreateUndoLevel !== false |
3986 edits, |
5201 }; |
3987 _yield$select2, |
3988 id, |
|
3989 type, |
|
3990 noChange, |
|
3991 _args12 = arguments; |
|
3992 |
|
3993 return external_this_regeneratorRuntime_default.a.wrap(function resetEditorBlocks$(_context11) { |
|
3994 while (1) { |
|
3995 switch (_context11.prev = _context11.next) { |
|
3996 case 0: |
|
3997 options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {}; |
|
3998 __unstableShouldCreateUndoLevel = options.__unstableShouldCreateUndoLevel, selectionStart = options.selectionStart, selectionEnd = options.selectionEnd; |
|
3999 edits = { |
|
4000 blocks: blocks, |
|
4001 selectionStart: selectionStart, |
|
4002 selectionEnd: selectionEnd |
|
4003 }; |
|
4004 |
|
4005 if (!(__unstableShouldCreateUndoLevel !== false)) { |
|
4006 _context11.next = 19; |
|
4007 break; |
|
4008 } |
|
4009 |
|
4010 _context11.next = 6; |
|
4011 return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); |
|
4012 |
|
4013 case 6: |
|
4014 _yield$select2 = _context11.sent; |
|
4015 id = _yield$select2.id; |
|
4016 type = _yield$select2.type; |
|
4017 _context11.next = 11; |
|
4018 return Object(external_this_wp_dataControls_["__unstableSyncSelect"])('core', 'getEditedEntityRecord', 'postType', type, id); |
|
4019 |
|
4020 case 11: |
|
4021 _context11.t0 = _context11.sent.blocks; |
|
4022 _context11.t1 = edits.blocks; |
|
4023 noChange = _context11.t0 === _context11.t1; |
|
4024 |
|
4025 if (!noChange) { |
|
4026 _context11.next = 18; |
|
4027 break; |
|
4028 } |
|
4029 |
|
4030 _context11.next = 17; |
|
4031 return Object(external_this_wp_dataControls_["dispatch"])('core', '__unstableCreateUndoLevel', 'postType', type, id); |
|
4032 |
|
4033 case 17: |
|
4034 return _context11.abrupt("return", _context11.sent); |
|
4035 |
|
4036 case 18: |
|
4037 // We create a new function here on every persistent edit |
|
4038 // to make sure the edit makes the post dirty and creates |
|
4039 // a new undo level. |
|
4040 edits.content = function (_ref) { |
|
4041 var _ref$blocks = _ref.blocks, |
|
4042 blocksForSerialization = _ref$blocks === void 0 ? [] : _ref$blocks; |
|
4043 return serialize_blocks(blocksForSerialization); |
|
4044 }; |
|
4045 |
|
4046 case 19: |
|
4047 return _context11.delegateYield(actions_editPost(edits), "t2", 20); |
|
4048 |
|
4049 case 20: |
|
4050 case "end": |
|
4051 return _context11.stop(); |
|
4052 } |
|
4053 } |
|
4054 }, _marked11); |
|
5202 } |
4055 } |
5203 /* |
4056 /* |
5204 * Returns an action object used in signalling that the post editor settings have been updated. |
4057 * Returns an action object used in signalling that the post editor settings have been updated. |
5205 * |
4058 * |
5206 * @param {Object} settings Updated settings |
4059 * @param {Object} settings Updated settings |
5217 /** |
4070 /** |
5218 * Backward compatibility |
4071 * Backward compatibility |
5219 */ |
4072 */ |
5220 |
4073 |
5221 var actions_getBlockEditorAction = function getBlockEditorAction(name) { |
4074 var actions_getBlockEditorAction = function getBlockEditorAction(name) { |
5222 return ( |
4075 return /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee() { |
5223 /*#__PURE__*/ |
4076 var _len, |
5224 regenerator_default.a.mark(function _callee() { |
4077 args, |
5225 var _len, |
4078 _key, |
5226 args, |
4079 _args13 = arguments; |
5227 _key, |
4080 |
5228 _args5 = arguments; |
4081 return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context12) { |
5229 |
4082 while (1) { |
5230 return regenerator_default.a.wrap(function _callee$(_context5) { |
4083 switch (_context12.prev = _context12.next) { |
5231 while (1) { |
4084 case 0: |
5232 switch (_context5.prev = _context5.next) { |
4085 external_this_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { |
5233 case 0: |
4086 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`' |
5234 for (_len = _args5.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
4087 }); |
5235 args[_key] = _args5[_key]; |
4088 |
5236 } |
4089 for (_len = _args13.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
5237 |
4090 args[_key] = _args13[_key]; |
5238 _context5.next = 3; |
4091 } |
5239 return controls_dispatch.apply(void 0, ['core/block-editor', name].concat(args)); |
4092 |
5240 |
4093 _context12.next = 4; |
5241 case 3: |
4094 return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/block-editor', name].concat(args)); |
5242 case "end": |
4095 |
5243 return _context5.stop(); |
4096 case 4: |
5244 } |
4097 case "end": |
4098 return _context12.stop(); |
|
5245 } |
4099 } |
5246 }, _callee, this); |
4100 } |
5247 }) |
4101 }, _callee); |
5248 ); |
4102 }); |
5249 }; |
4103 }; |
4104 /** |
|
4105 * @see resetBlocks in core/block-editor store. |
|
4106 */ |
|
4107 |
|
5250 |
4108 |
5251 var resetBlocks = actions_getBlockEditorAction('resetBlocks'); |
4109 var resetBlocks = actions_getBlockEditorAction('resetBlocks'); |
4110 /** |
|
4111 * @see receiveBlocks in core/block-editor store. |
|
4112 */ |
|
4113 |
|
5252 var receiveBlocks = actions_getBlockEditorAction('receiveBlocks'); |
4114 var receiveBlocks = actions_getBlockEditorAction('receiveBlocks'); |
4115 /** |
|
4116 * @see updateBlock in core/block-editor store. |
|
4117 */ |
|
4118 |
|
5253 var updateBlock = actions_getBlockEditorAction('updateBlock'); |
4119 var updateBlock = actions_getBlockEditorAction('updateBlock'); |
4120 /** |
|
4121 * @see updateBlockAttributes in core/block-editor store. |
|
4122 */ |
|
4123 |
|
5254 var updateBlockAttributes = actions_getBlockEditorAction('updateBlockAttributes'); |
4124 var updateBlockAttributes = actions_getBlockEditorAction('updateBlockAttributes'); |
5255 var selectBlock = actions_getBlockEditorAction('selectBlock'); |
4125 /** |
4126 * @see selectBlock in core/block-editor store. |
|
4127 */ |
|
4128 |
|
4129 var actions_selectBlock = actions_getBlockEditorAction('selectBlock'); |
|
4130 /** |
|
4131 * @see startMultiSelect in core/block-editor store. |
|
4132 */ |
|
4133 |
|
5256 var startMultiSelect = actions_getBlockEditorAction('startMultiSelect'); |
4134 var startMultiSelect = actions_getBlockEditorAction('startMultiSelect'); |
4135 /** |
|
4136 * @see stopMultiSelect in core/block-editor store. |
|
4137 */ |
|
4138 |
|
5257 var stopMultiSelect = actions_getBlockEditorAction('stopMultiSelect'); |
4139 var stopMultiSelect = actions_getBlockEditorAction('stopMultiSelect'); |
4140 /** |
|
4141 * @see multiSelect in core/block-editor store. |
|
4142 */ |
|
4143 |
|
5258 var multiSelect = actions_getBlockEditorAction('multiSelect'); |
4144 var multiSelect = actions_getBlockEditorAction('multiSelect'); |
4145 /** |
|
4146 * @see clearSelectedBlock in core/block-editor store. |
|
4147 */ |
|
4148 |
|
5259 var clearSelectedBlock = actions_getBlockEditorAction('clearSelectedBlock'); |
4149 var clearSelectedBlock = actions_getBlockEditorAction('clearSelectedBlock'); |
4150 /** |
|
4151 * @see toggleSelection in core/block-editor store. |
|
4152 */ |
|
4153 |
|
5260 var toggleSelection = actions_getBlockEditorAction('toggleSelection'); |
4154 var toggleSelection = actions_getBlockEditorAction('toggleSelection'); |
5261 var replaceBlocks = actions_getBlockEditorAction('replaceBlocks'); |
4155 /** |
4156 * @see replaceBlocks in core/block-editor store. |
|
4157 */ |
|
4158 |
|
4159 var actions_replaceBlocks = actions_getBlockEditorAction('replaceBlocks'); |
|
4160 /** |
|
4161 * @see replaceBlock in core/block-editor store. |
|
4162 */ |
|
4163 |
|
5262 var replaceBlock = actions_getBlockEditorAction('replaceBlock'); |
4164 var replaceBlock = actions_getBlockEditorAction('replaceBlock'); |
4165 /** |
|
4166 * @see moveBlocksDown in core/block-editor store. |
|
4167 */ |
|
4168 |
|
5263 var moveBlocksDown = actions_getBlockEditorAction('moveBlocksDown'); |
4169 var moveBlocksDown = actions_getBlockEditorAction('moveBlocksDown'); |
4170 /** |
|
4171 * @see moveBlocksUp in core/block-editor store. |
|
4172 */ |
|
4173 |
|
5264 var moveBlocksUp = actions_getBlockEditorAction('moveBlocksUp'); |
4174 var moveBlocksUp = actions_getBlockEditorAction('moveBlocksUp'); |
4175 /** |
|
4176 * @see moveBlockToPosition in core/block-editor store. |
|
4177 */ |
|
4178 |
|
5265 var moveBlockToPosition = actions_getBlockEditorAction('moveBlockToPosition'); |
4179 var moveBlockToPosition = actions_getBlockEditorAction('moveBlockToPosition'); |
4180 /** |
|
4181 * @see insertBlock in core/block-editor store. |
|
4182 */ |
|
4183 |
|
5266 var insertBlock = actions_getBlockEditorAction('insertBlock'); |
4184 var insertBlock = actions_getBlockEditorAction('insertBlock'); |
4185 /** |
|
4186 * @see insertBlocks in core/block-editor store. |
|
4187 */ |
|
4188 |
|
5267 var insertBlocks = actions_getBlockEditorAction('insertBlocks'); |
4189 var insertBlocks = actions_getBlockEditorAction('insertBlocks'); |
4190 /** |
|
4191 * @see showInsertionPoint in core/block-editor store. |
|
4192 */ |
|
4193 |
|
5268 var showInsertionPoint = actions_getBlockEditorAction('showInsertionPoint'); |
4194 var showInsertionPoint = actions_getBlockEditorAction('showInsertionPoint'); |
4195 /** |
|
4196 * @see hideInsertionPoint in core/block-editor store. |
|
4197 */ |
|
4198 |
|
5269 var hideInsertionPoint = actions_getBlockEditorAction('hideInsertionPoint'); |
4199 var hideInsertionPoint = actions_getBlockEditorAction('hideInsertionPoint'); |
4200 /** |
|
4201 * @see setTemplateValidity in core/block-editor store. |
|
4202 */ |
|
4203 |
|
5270 var setTemplateValidity = actions_getBlockEditorAction('setTemplateValidity'); |
4204 var setTemplateValidity = actions_getBlockEditorAction('setTemplateValidity'); |
4205 /** |
|
4206 * @see synchronizeTemplate in core/block-editor store. |
|
4207 */ |
|
4208 |
|
5271 var synchronizeTemplate = actions_getBlockEditorAction('synchronizeTemplate'); |
4209 var synchronizeTemplate = actions_getBlockEditorAction('synchronizeTemplate'); |
4210 /** |
|
4211 * @see mergeBlocks in core/block-editor store. |
|
4212 */ |
|
4213 |
|
5272 var mergeBlocks = actions_getBlockEditorAction('mergeBlocks'); |
4214 var mergeBlocks = actions_getBlockEditorAction('mergeBlocks'); |
4215 /** |
|
4216 * @see removeBlocks in core/block-editor store. |
|
4217 */ |
|
4218 |
|
5273 var removeBlocks = actions_getBlockEditorAction('removeBlocks'); |
4219 var removeBlocks = actions_getBlockEditorAction('removeBlocks'); |
4220 /** |
|
4221 * @see removeBlock in core/block-editor store. |
|
4222 */ |
|
4223 |
|
5274 var removeBlock = actions_getBlockEditorAction('removeBlock'); |
4224 var removeBlock = actions_getBlockEditorAction('removeBlock'); |
4225 /** |
|
4226 * @see toggleBlockMode in core/block-editor store. |
|
4227 */ |
|
4228 |
|
5275 var toggleBlockMode = actions_getBlockEditorAction('toggleBlockMode'); |
4229 var toggleBlockMode = actions_getBlockEditorAction('toggleBlockMode'); |
4230 /** |
|
4231 * @see startTyping in core/block-editor store. |
|
4232 */ |
|
4233 |
|
5276 var startTyping = actions_getBlockEditorAction('startTyping'); |
4234 var startTyping = actions_getBlockEditorAction('startTyping'); |
4235 /** |
|
4236 * @see stopTyping in core/block-editor store. |
|
4237 */ |
|
4238 |
|
5277 var stopTyping = actions_getBlockEditorAction('stopTyping'); |
4239 var stopTyping = actions_getBlockEditorAction('stopTyping'); |
4240 /** |
|
4241 * @see enterFormattedText in core/block-editor store. |
|
4242 */ |
|
4243 |
|
5278 var enterFormattedText = actions_getBlockEditorAction('enterFormattedText'); |
4244 var enterFormattedText = actions_getBlockEditorAction('enterFormattedText'); |
4245 /** |
|
4246 * @see exitFormattedText in core/block-editor store. |
|
4247 */ |
|
4248 |
|
5279 var exitFormattedText = actions_getBlockEditorAction('exitFormattedText'); |
4249 var exitFormattedText = actions_getBlockEditorAction('exitFormattedText'); |
4250 /** |
|
4251 * @see insertDefaultBlock in core/block-editor store. |
|
4252 */ |
|
4253 |
|
5280 var insertDefaultBlock = actions_getBlockEditorAction('insertDefaultBlock'); |
4254 var insertDefaultBlock = actions_getBlockEditorAction('insertDefaultBlock'); |
4255 /** |
|
4256 * @see updateBlockListSettings in core/block-editor store. |
|
4257 */ |
|
4258 |
|
5281 var updateBlockListSettings = actions_getBlockEditorAction('updateBlockListSettings'); |
4259 var updateBlockListSettings = actions_getBlockEditorAction('updateBlockListSettings'); |
5282 |
4260 |
5283 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js |
4261 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
5284 var asyncToGenerator = __webpack_require__(44); |
4262 var slicedToArray = __webpack_require__(14); |
5285 |
4263 |
5286 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
4264 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
5287 var rememo = __webpack_require__(30); |
4265 var rememo = __webpack_require__(42); |
5288 |
4266 |
5289 // EXTERNAL MODULE: external {"this":["wp","date"]} |
4267 // EXTERNAL MODULE: external {"this":["wp","date"]} |
5290 var external_this_wp_date_ = __webpack_require__(50); |
4268 var external_this_wp_date_ = __webpack_require__(79); |
5291 |
4269 |
5292 // EXTERNAL MODULE: external {"this":["wp","autop"]} |
4270 // EXTERNAL MODULE: external {"this":["wp","url"]} |
5293 var external_this_wp_autop_ = __webpack_require__(66); |
4271 var external_this_wp_url_ = __webpack_require__(31); |
4272 |
|
4273 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js |
|
4274 /** |
|
4275 * External dependencies |
|
4276 */ |
|
4277 |
|
4278 /** |
|
4279 * WordPress dependencies |
|
4280 */ |
|
4281 |
|
4282 |
|
4283 /** |
|
4284 * Returns the URL of a WPAdmin Page. |
|
4285 * |
|
4286 * TODO: This should be moved to a module less specific to the editor. |
|
4287 * |
|
4288 * @param {string} page Page to navigate to. |
|
4289 * @param {Object} query Query Args. |
|
4290 * |
|
4291 * @return {string} WPAdmin URL. |
|
4292 */ |
|
4293 |
|
4294 function getWPAdminURL(page, query) { |
|
4295 return Object(external_this_wp_url_["addQueryArgs"])(page, query); |
|
4296 } |
|
4297 /** |
|
4298 * Performs some basic cleanup of a string for use as a post slug |
|
4299 * |
|
4300 * This replicates some of what sanitize_title() does in WordPress core, but |
|
4301 * is only designed to approximate what the slug will be. |
|
4302 * |
|
4303 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin |
|
4304 * letters. Removes combining diacritical marks. Converts whitespace, periods, |
|
4305 * and forward slashes to hyphens. Removes any remaining non-word characters |
|
4306 * except hyphens. Converts remaining string to lowercase. It does not account |
|
4307 * for octets, HTML entities, or other encoded characters. |
|
4308 * |
|
4309 * @param {string} string Title or slug to be processed |
|
4310 * |
|
4311 * @return {string} Processed string |
|
4312 */ |
|
4313 |
|
4314 function cleanForSlug(string) { |
|
4315 if (!string) { |
|
4316 return ''; |
|
4317 } |
|
4318 |
|
4319 return Object(external_this_lodash_["trim"])(Object(external_this_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-'); |
|
4320 } |
|
5294 |
4321 |
5295 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
4322 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
5296 |
4323 |
5297 |
4324 |
5298 |
4325 |
4326 function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
4327 |
|
4328 function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
4329 |
|
5299 /** |
4330 /** |
5300 * External dependencies |
4331 * External dependencies |
5301 */ |
4332 */ |
5302 |
4333 |
5303 |
4334 |
5311 |
4342 |
5312 |
4343 |
5313 /** |
4344 /** |
5314 * Internal dependencies |
4345 * Internal dependencies |
5315 */ |
4346 */ |
4347 |
|
4348 |
|
4349 |
|
5316 |
4350 |
5317 |
4351 |
5318 |
4352 |
5319 /** |
4353 /** |
5320 * Shared reference to an empty object for cases where it is important to avoid |
4354 * Shared reference to an empty object for cases where it is important to avoid |
5324 * maintained by the reducer result in state. |
4358 * maintained by the reducer result in state. |
5325 */ |
4359 */ |
5326 |
4360 |
5327 var EMPTY_OBJECT = {}; |
4361 var EMPTY_OBJECT = {}; |
5328 /** |
4362 /** |
4363 * Shared reference to an empty array for cases where it is important to avoid |
|
4364 * returning a new array reference on every invocation, as in a connected or |
|
4365 * other pure component which performs `shouldComponentUpdate` check on props. |
|
4366 * This should be used as a last resort, since the normalized data should be |
|
4367 * maintained by the reducer result in state. |
|
4368 */ |
|
4369 |
|
4370 var EMPTY_ARRAY = []; |
|
4371 /** |
|
5329 * Returns true if any past editor history snapshots exist, or false otherwise. |
4372 * Returns true if any past editor history snapshots exist, or false otherwise. |
5330 * |
4373 * |
5331 * @param {Object} state Global application state. |
4374 * @param {Object} state Global application state. |
5332 * |
4375 * |
5333 * @return {boolean} Whether undo history exists. |
4376 * @return {boolean} Whether undo history exists. |
5334 */ |
4377 */ |
5335 |
4378 |
5336 function hasEditorUndo(state) { |
4379 var hasEditorUndo = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5337 return state.editor.past.length > 0; |
4380 return function () { |
5338 } |
4381 return select('core').hasUndo(); |
4382 }; |
|
4383 }); |
|
5339 /** |
4384 /** |
5340 * Returns true if any future editor history snapshots exist, or false |
4385 * Returns true if any future editor history snapshots exist, or false |
5341 * otherwise. |
4386 * otherwise. |
5342 * |
4387 * |
5343 * @param {Object} state Global application state. |
4388 * @param {Object} state Global application state. |
5344 * |
4389 * |
5345 * @return {boolean} Whether redo history exists. |
4390 * @return {boolean} Whether redo history exists. |
5346 */ |
4391 */ |
5347 |
4392 |
5348 function hasEditorRedo(state) { |
4393 var hasEditorRedo = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5349 return state.editor.future.length > 0; |
4394 return function () { |
5350 } |
4395 return select('core').hasRedo(); |
4396 }; |
|
4397 }); |
|
5351 /** |
4398 /** |
5352 * Returns true if the currently edited post is yet to be saved, or false if |
4399 * Returns true if the currently edited post is yet to be saved, or false if |
5353 * the post has been saved. |
4400 * the post has been saved. |
5354 * |
4401 * |
5355 * @param {Object} state Global application state. |
4402 * @param {Object} state Global application state. |
5356 * |
4403 * |
5357 * @return {boolean} Whether the post is new. |
4404 * @return {boolean} Whether the post is new. |
5358 */ |
4405 */ |
5359 |
4406 |
5360 function selectors_isEditedPostNew(state) { |
4407 function isEditedPostNew(state) { |
5361 return selectors_getCurrentPost(state).status === 'auto-draft'; |
4408 return selectors_getCurrentPost(state).status === 'auto-draft'; |
5362 } |
4409 } |
5363 /** |
4410 /** |
5364 * Returns true if content includes unsaved changes, or false otherwise. |
4411 * Returns true if content includes unsaved changes, or false otherwise. |
5365 * |
4412 * |
5367 * |
4414 * |
5368 * @return {boolean} Whether content includes unsaved changes. |
4415 * @return {boolean} Whether content includes unsaved changes. |
5369 */ |
4416 */ |
5370 |
4417 |
5371 function hasChangedContent(state) { |
4418 function hasChangedContent(state) { |
5372 return state.editor.present.blocks.isDirty || // `edits` is intended to contain only values which are different from |
4419 var edits = selectors_getPostEdits(state); |
4420 return 'blocks' in edits || // `edits` is intended to contain only values which are different from |
|
5373 // the saved post, so the mere presence of a property is an indicator |
4421 // the saved post, so the mere presence of a property is an indicator |
5374 // that the value is different than what is known to be saved. While |
4422 // that the value is different than what is known to be saved. While |
5375 // content in Visual mode is represented by the blocks state, in Text |
4423 // content in Visual mode is represented by the blocks state, in Text |
5376 // mode it is tracked by `edits.content`. |
4424 // mode it is tracked by `edits.content`. |
5377 'content' in state.editor.present.edits; |
4425 'content' in edits; |
5378 } |
4426 } |
5379 /** |
4427 /** |
5380 * Returns true if there are unsaved values for the current edit session, or |
4428 * Returns true if there are unsaved values for the current edit session, or |
5381 * false if the editing state matches the saved or new post. |
4429 * false if the editing state matches the saved or new post. |
5382 * |
4430 * |
5383 * @param {Object} state Global application state. |
4431 * @param {Object} state Global application state. |
5384 * |
4432 * |
5385 * @return {boolean} Whether unsaved values exist. |
4433 * @return {boolean} Whether unsaved values exist. |
5386 */ |
4434 */ |
5387 |
4435 |
5388 function selectors_isEditedPostDirty(state) { |
4436 var selectors_isEditedPostDirty = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5389 if (hasChangedContent(state)) { |
4437 return function (state) { |
5390 return true; |
4438 // Edits should contain only fields which differ from the saved post (reset |
5391 } // Edits should contain only fields which differ from the saved post (reset |
4439 // at initial load and save complete). Thus, a non-empty edits state can be |
5392 // at initial load and save complete). Thus, a non-empty edits state can be |
4440 // inferred to contain unsaved values. |
5393 // inferred to contain unsaved values. |
4441 var postType = selectors_getCurrentPostType(state); |
5394 |
4442 var postId = selectors_getCurrentPostId(state); |
5395 |
4443 |
5396 if (Object.keys(state.editor.present.edits).length > 0) { |
4444 if (select('core').hasEditsForEntityRecord('postType', postType, postId)) { |
5397 return true; |
4445 return true; |
5398 } // Edits and change detection are reset at the start of a save, but a post |
4446 } |
5399 // is still considered dirty until the point at which the save completes. |
4447 |
5400 // Because the save is performed optimistically, the prior states are held |
4448 return false; |
5401 // until committed. These can be referenced to determine whether there's a |
4449 }; |
5402 // chance that state may be reverted into one considered dirty. |
4450 }); |
5403 |
4451 /** |
5404 |
4452 * Returns true if there are unsaved edits for entities other than |
5405 return inSomeHistory(state, selectors_isEditedPostDirty); |
4453 * the editor's post, and false otherwise. |
5406 } |
4454 * |
4455 * @param {Object} state Global application state. |
|
4456 * |
|
4457 * @return {boolean} Whether there are edits or not. |
|
4458 */ |
|
4459 |
|
4460 var selectors_hasNonPostEntityChanges = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
|
4461 return function (state) { |
|
4462 var enableFullSiteEditing = selectors_getEditorSettings(state).__experimentalEnableFullSiteEditing; |
|
4463 |
|
4464 if (!enableFullSiteEditing) { |
|
4465 return false; |
|
4466 } |
|
4467 |
|
4468 var dirtyEntityRecords = select('core').__experimentalGetDirtyEntityRecords(); |
|
4469 |
|
4470 var _getCurrentPost = selectors_getCurrentPost(state), |
|
4471 type = _getCurrentPost.type, |
|
4472 id = _getCurrentPost.id; |
|
4473 |
|
4474 return Object(external_this_lodash_["some"])(dirtyEntityRecords, function (entityRecord) { |
|
4475 return entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id; |
|
4476 }); |
|
4477 }; |
|
4478 }); |
|
5407 /** |
4479 /** |
5408 * Returns true if there are no unsaved values for the current edit session and |
4480 * Returns true if there are no unsaved values for the current edit session and |
5409 * if the currently edited post is new (has never been saved before). |
4481 * if the currently edited post is new (has never been saved before). |
5410 * |
4482 * |
5411 * @param {Object} state Global application state. |
4483 * @param {Object} state Global application state. |
5412 * |
4484 * |
5413 * @return {boolean} Whether new post and unsaved values exist. |
4485 * @return {boolean} Whether new post and unsaved values exist. |
5414 */ |
4486 */ |
5415 |
4487 |
5416 function selectors_isCleanNewPost(state) { |
4488 function selectors_isCleanNewPost(state) { |
5417 return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state); |
4489 return !selectors_isEditedPostDirty(state) && isEditedPostNew(state); |
5418 } |
4490 } |
5419 /** |
4491 /** |
5420 * Returns the post currently being edited in its last known saved state, not |
4492 * Returns the post currently being edited in its last known saved state, not |
5421 * including unsaved edits. Returns an object containing relevant default post |
4493 * including unsaved edits. Returns an object containing relevant default post |
5422 * values if the post has not yet been saved. |
4494 * values if the post has not yet been saved. |
5424 * @param {Object} state Global application state. |
4496 * @param {Object} state Global application state. |
5425 * |
4497 * |
5426 * @return {Object} Post object. |
4498 * @return {Object} Post object. |
5427 */ |
4499 */ |
5428 |
4500 |
5429 function selectors_getCurrentPost(state) { |
4501 var selectors_getCurrentPost = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5430 return state.currentPost; |
4502 return function (state) { |
5431 } |
4503 var postId = selectors_getCurrentPostId(state); |
4504 var postType = selectors_getCurrentPostType(state); |
|
4505 var post = select('core').getRawEntityRecord('postType', postType, postId); |
|
4506 |
|
4507 if (post) { |
|
4508 return post; |
|
4509 } // This exists for compatibility with the previous selector behavior |
|
4510 // which would guarantee an object return based on the editor reducer's |
|
4511 // default empty object state. |
|
4512 |
|
4513 |
|
4514 return EMPTY_OBJECT; |
|
4515 }; |
|
4516 }); |
|
5432 /** |
4517 /** |
5433 * Returns the post type of the post currently being edited. |
4518 * Returns the post type of the post currently being edited. |
5434 * |
4519 * |
5435 * @param {Object} state Global application state. |
4520 * @param {Object} state Global application state. |
5436 * |
4521 * |
5437 * @return {string} Post type. |
4522 * @return {string} Post type. |
5438 */ |
4523 */ |
5439 |
4524 |
5440 function selectors_getCurrentPostType(state) { |
4525 function selectors_getCurrentPostType(state) { |
5441 return state.currentPost.type; |
4526 return state.postType; |
5442 } |
4527 } |
5443 /** |
4528 /** |
5444 * Returns the ID of the post currently being edited, or null if the post has |
4529 * Returns the ID of the post currently being edited, or null if the post has |
5445 * not yet been saved. |
4530 * not yet been saved. |
5446 * |
4531 * |
5448 * |
4533 * |
5449 * @return {?number} ID of current post. |
4534 * @return {?number} ID of current post. |
5450 */ |
4535 */ |
5451 |
4536 |
5452 function selectors_getCurrentPostId(state) { |
4537 function selectors_getCurrentPostId(state) { |
5453 return selectors_getCurrentPost(state).id || null; |
4538 return state.postId; |
5454 } |
4539 } |
5455 /** |
4540 /** |
5456 * Returns the number of revisions of the post currently being edited. |
4541 * Returns the number of revisions of the post currently being edited. |
5457 * |
4542 * |
5458 * @param {Object} state Global application state. |
4543 * @param {Object} state Global application state. |
5459 * |
4544 * |
5460 * @return {number} Number of revisions. |
4545 * @return {number} Number of revisions. |
5461 */ |
4546 */ |
5462 |
4547 |
5463 function getCurrentPostRevisionsCount(state) { |
4548 function getCurrentPostRevisionsCount(state) { |
5464 return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); |
4549 return Object(external_this_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); |
5465 } |
4550 } |
5466 /** |
4551 /** |
5467 * Returns the last revision ID of the post currently being edited, |
4552 * Returns the last revision ID of the post currently being edited, |
5468 * or null if the post has no revisions. |
4553 * or null if the post has no revisions. |
5469 * |
4554 * |
5471 * |
4556 * |
5472 * @return {?number} ID of the last revision. |
4557 * @return {?number} ID of the last revision. |
5473 */ |
4558 */ |
5474 |
4559 |
5475 function getCurrentPostLastRevisionId(state) { |
4560 function getCurrentPostLastRevisionId(state) { |
5476 return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); |
4561 return Object(external_this_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); |
5477 } |
4562 } |
5478 /** |
4563 /** |
5479 * Returns any post values which have been changed in the editor but not yet |
4564 * Returns any post values which have been changed in the editor but not yet |
5480 * been saved. |
4565 * been saved. |
5481 * |
4566 * |
5482 * @param {Object} state Global application state. |
4567 * @param {Object} state Global application state. |
5483 * |
4568 * |
5484 * @return {Object} Object of key value pairs comprising unsaved edits. |
4569 * @return {Object} Object of key value pairs comprising unsaved edits. |
5485 */ |
4570 */ |
5486 |
4571 |
5487 var getPostEdits = Object(rememo["a" /* default */])(function (state) { |
4572 var selectors_getPostEdits = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5488 return Object(objectSpread["a" /* default */])({}, state.initialEdits, state.editor.present.edits); |
4573 return function (state) { |
5489 }, function (state) { |
4574 var postType = selectors_getCurrentPostType(state); |
5490 return [state.editor.present.edits, state.initialEdits]; |
4575 var postId = selectors_getCurrentPostId(state); |
4576 return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; |
|
4577 }; |
|
5491 }); |
4578 }); |
5492 /** |
4579 /** |
5493 * Returns a new reference when edited values have changed. This is useful in |
4580 * Returns a new reference when edited values have changed. This is useful in |
5494 * inferring where an edit has been made between states by comparison of the |
4581 * inferring where an edit has been made between states by comparison of the |
5495 * return values using strict equality. |
4582 * return values using strict equality. |
4583 * |
|
4584 * @deprecated since Gutenberg 6.5.0. |
|
5496 * |
4585 * |
5497 * @example |
4586 * @example |
5498 * |
4587 * |
5499 * ``` |
4588 * ``` |
5500 * const hasEditOccurred = ( |
4589 * const hasEditOccurred = ( |
5506 * @param {Object} state Editor state. |
4595 * @param {Object} state Editor state. |
5507 * |
4596 * |
5508 * @return {*} A value whose reference will change only when an edit occurs. |
4597 * @return {*} A value whose reference will change only when an edit occurs. |
5509 */ |
4598 */ |
5510 |
4599 |
5511 var getReferenceByDistinctEdits = Object(rememo["a" /* default */])(function () { |
4600 var getReferenceByDistinctEdits = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5512 return []; |
4601 return function () |
5513 }, function (state) { |
4602 /* state */ |
5514 return [state.editor]; |
4603 { |
4604 external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`", { |
|
4605 alternative: "`wp.data.select( 'core' ).getReferenceByDistinctEdits`" |
|
4606 }); |
|
4607 return select('core').getReferenceByDistinctEdits(); |
|
4608 }; |
|
5515 }); |
4609 }); |
5516 /** |
4610 /** |
5517 * Returns an attribute value of the saved post. |
4611 * Returns an attribute value of the saved post. |
5518 * |
4612 * |
5519 * @param {Object} state Global application state. |
4613 * @param {Object} state Global application state. |
5521 * |
4615 * |
5522 * @return {*} Post attribute value. |
4616 * @return {*} Post attribute value. |
5523 */ |
4617 */ |
5524 |
4618 |
5525 function selectors_getCurrentPostAttribute(state, attributeName) { |
4619 function selectors_getCurrentPostAttribute(state, attributeName) { |
5526 var post = selectors_getCurrentPost(state); |
4620 switch (attributeName) { |
5527 |
4621 case 'type': |
5528 if (post.hasOwnProperty(attributeName)) { |
4622 return selectors_getCurrentPostType(state); |
5529 return post[attributeName]; |
4623 |
4624 case 'id': |
|
4625 return selectors_getCurrentPostId(state); |
|
4626 |
|
4627 default: |
|
4628 var post = selectors_getCurrentPost(state); |
|
4629 |
|
4630 if (!post.hasOwnProperty(attributeName)) { |
|
4631 break; |
|
4632 } |
|
4633 |
|
4634 return getPostRawValue(post[attributeName]); |
|
5530 } |
4635 } |
5531 } |
4636 } |
5532 /** |
4637 /** |
5533 * Returns a single attribute of the post being edited, preferring the unsaved |
4638 * Returns a single attribute of the post being edited, preferring the unsaved |
5534 * edit if one exists, but merging with the attribute value for the last known |
4639 * edit if one exists, but merging with the attribute value for the last known |
5538 * @param {string} attributeName Post attribute name. |
4643 * @param {string} attributeName Post attribute name. |
5539 * |
4644 * |
5540 * @return {*} Post attribute value. |
4645 * @return {*} Post attribute value. |
5541 */ |
4646 */ |
5542 |
4647 |
5543 var getNestedEditedPostProperty = Object(rememo["a" /* default */])(function (state, attributeName) { |
4648 var getNestedEditedPostProperty = function getNestedEditedPostProperty(state, attributeName) { |
5544 var edits = getPostEdits(state); |
4649 var edits = selectors_getPostEdits(state); |
5545 |
4650 |
5546 if (!edits.hasOwnProperty(attributeName)) { |
4651 if (!edits.hasOwnProperty(attributeName)) { |
5547 return selectors_getCurrentPostAttribute(state, attributeName); |
4652 return selectors_getCurrentPostAttribute(state, attributeName); |
5548 } |
4653 } |
5549 |
4654 |
5550 return Object(objectSpread["a" /* default */])({}, selectors_getCurrentPostAttribute(state, attributeName), edits[attributeName]); |
4655 return selectors_objectSpread({}, selectors_getCurrentPostAttribute(state, attributeName), {}, edits[attributeName]); |
5551 }, function (state, attributeName) { |
4656 }; |
5552 return [Object(external_lodash_["get"])(state.editor.present.edits, [attributeName], EMPTY_OBJECT), Object(external_lodash_["get"])(state.currentPost, [attributeName], EMPTY_OBJECT)]; |
|
5553 }); |
|
5554 /** |
4657 /** |
5555 * Returns a single attribute of the post being edited, preferring the unsaved |
4658 * Returns a single attribute of the post being edited, preferring the unsaved |
5556 * edit if one exists, but falling back to the attribute for the last known |
4659 * edit if one exists, but falling back to the attribute for the last known |
5557 * saved state of the post. |
4660 * saved state of the post. |
5558 * |
4661 * |
5559 * @param {Object} state Global application state. |
4662 * @param {Object} state Global application state. |
5560 * @param {string} attributeName Post attribute name. |
4663 * @param {string} attributeName Post attribute name. |
5561 * |
4664 * |
5562 * @return {*} Post attribute value. |
4665 * @return {*} Post attribute value. |
5563 */ |
4666 */ |
4667 |
|
5564 |
4668 |
5565 function selectors_getEditedPostAttribute(state, attributeName) { |
4669 function selectors_getEditedPostAttribute(state, attributeName) { |
5566 // Special cases |
4670 // Special cases |
5567 switch (attributeName) { |
4671 switch (attributeName) { |
5568 case 'content': |
4672 case 'content': |
5569 return getEditedPostContent(state); |
4673 return getEditedPostContent(state); |
5570 } // Fall back to saved post value if not edited. |
4674 } // Fall back to saved post value if not edited. |
5571 |
4675 |
5572 |
4676 |
5573 var edits = getPostEdits(state); |
4677 var edits = selectors_getPostEdits(state); |
5574 |
4678 |
5575 if (!edits.hasOwnProperty(attributeName)) { |
4679 if (!edits.hasOwnProperty(attributeName)) { |
5576 return selectors_getCurrentPostAttribute(state, attributeName); |
4680 return selectors_getCurrentPostAttribute(state, attributeName); |
5577 } // Merge properties are objects which contain only the patch edit in state, |
4681 } // Merge properties are objects which contain only the patch edit in state, |
5578 // and thus must be merged with the current post attribute. |
4682 // and thus must be merged with the current post attribute. |
5586 } |
4690 } |
5587 /** |
4691 /** |
5588 * Returns an attribute value of the current autosave revision for a post, or |
4692 * Returns an attribute value of the current autosave revision for a post, or |
5589 * null if there is no autosave for the post. |
4693 * null if there is no autosave for the post. |
5590 * |
4694 * |
4695 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector |
|
4696 * from the '@wordpress/core-data' package and access properties on the returned |
|
4697 * autosave object using getPostRawValue. |
|
4698 * |
|
5591 * @param {Object} state Global application state. |
4699 * @param {Object} state Global application state. |
5592 * @param {string} attributeName Autosave attribute name. |
4700 * @param {string} attributeName Autosave attribute name. |
5593 * |
4701 * |
5594 * @return {*} Autosave attribute value. |
4702 * @return {*} Autosave attribute value. |
5595 */ |
4703 */ |
5596 |
4704 |
5597 function getAutosaveAttribute(state, attributeName) { |
4705 var getAutosaveAttribute = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5598 if (!hasAutosave(state)) { |
4706 return function (state, attributeName) { |
5599 return null; |
4707 if (!Object(external_this_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') { |
5600 } |
4708 return; |
5601 |
4709 } |
5602 var autosave = getAutosave(state); |
4710 |
5603 |
4711 var postType = selectors_getCurrentPostType(state); |
5604 if (autosave.hasOwnProperty(attributeName)) { |
4712 var postId = selectors_getCurrentPostId(state); |
5605 return autosave[attributeName]; |
4713 var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); |
5606 } |
4714 var autosave = select('core').getAutosave(postType, postId, currentUserId); |
5607 } |
4715 |
4716 if (autosave) { |
|
4717 return getPostRawValue(autosave[attributeName]); |
|
4718 } |
|
4719 }; |
|
4720 }); |
|
5608 /** |
4721 /** |
5609 * Returns the current visibility of the post being edited, preferring the |
4722 * Returns the current visibility of the post being edited, preferring the |
5610 * unsaved value if different than the saved post. The return value is one of |
4723 * unsaved value if different than the saved post. The return value is one of |
5611 * "private", "password", or "public". |
4724 * "private", "password", or "public". |
5612 * |
4725 * |
5642 return selectors_getCurrentPost(state).status === 'pending'; |
4755 return selectors_getCurrentPost(state).status === 'pending'; |
5643 } |
4756 } |
5644 /** |
4757 /** |
5645 * Return true if the current post has already been published. |
4758 * Return true if the current post has already been published. |
5646 * |
4759 * |
5647 * @param {Object} state Global application state. |
4760 * @param {Object} state Global application state. |
4761 * @param {Object?} currentPost Explicit current post for bypassing registry selector. |
|
5648 * |
4762 * |
5649 * @return {boolean} Whether the post has been published. |
4763 * @return {boolean} Whether the post has been published. |
5650 */ |
4764 */ |
5651 |
4765 |
5652 function selectors_isCurrentPostPublished(state) { |
4766 function selectors_isCurrentPostPublished(state, currentPost) { |
5653 var post = selectors_getCurrentPost(state); |
4767 var post = currentPost || selectors_getCurrentPost(state); |
5654 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_this_wp_date_["isInTheFuture"])(new Date(Number(Object(external_this_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS)); |
4768 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_this_wp_date_["isInTheFuture"])(new Date(Number(Object(external_this_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS)); |
5655 } |
4769 } |
5656 /** |
4770 /** |
5657 * Returns true if post is already scheduled. |
4771 * Returns true if post is already scheduled. |
5658 * |
4772 * |
5720 // emptiness, testing saveable blocks length is a trivial operation. Since |
4834 // emptiness, testing saveable blocks length is a trivial operation. Since |
5721 // this function can be called frequently, optimize for the fast case as a |
4835 // this function can be called frequently, optimize for the fast case as a |
5722 // condition of the mere existence of blocks. Note that the value of edited |
4836 // condition of the mere existence of blocks. Note that the value of edited |
5723 // content takes precedent over block content, and must fall through to the |
4837 // content takes precedent over block content, and must fall through to the |
5724 // default logic. |
4838 // default logic. |
5725 var blocks = state.editor.present.blocks.value; |
4839 var blocks = selectors_getEditorBlocks(state); |
5726 |
4840 |
5727 if (blocks.length && !('content' in getPostEdits(state))) { |
4841 if (blocks.length) { |
5728 // Pierce the abstraction of the serializer in knowing that blocks are |
4842 // Pierce the abstraction of the serializer in knowing that blocks are |
5729 // joined with with newlines such that even if every individual block |
4843 // joined with with newlines such that even if every individual block |
5730 // produces an empty save result, the serialized content is non-empty. |
4844 // produces an empty save result, the serialized content is non-empty. |
5731 if (blocks.length > 1) { |
4845 if (blocks.length > 1) { |
5732 return false; |
4846 return false; |
5753 return !getEditedPostContent(state); |
4867 return !getEditedPostContent(state); |
5754 } |
4868 } |
5755 /** |
4869 /** |
5756 * Returns true if the post can be autosaved, or false otherwise. |
4870 * Returns true if the post can be autosaved, or false otherwise. |
5757 * |
4871 * |
5758 * @param {Object} state Global application state. |
4872 * @param {Object} state Global application state. |
4873 * @param {Object} autosave A raw autosave object from the REST API. |
|
5759 * |
4874 * |
5760 * @return {boolean} Whether the post can be autosaved. |
4875 * @return {boolean} Whether the post can be autosaved. |
5761 */ |
4876 */ |
5762 |
4877 |
5763 function selectors_isEditedPostAutosaveable(state) { |
4878 var selectors_isEditedPostAutosaveable = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5764 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. |
4879 return function (state) { |
5765 if (!selectors_isEditedPostSaveable(state)) { |
4880 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. |
5766 return false; |
4881 if (!selectors_isEditedPostSaveable(state)) { |
5767 } // If we don't already have an autosave, the post is autosaveable. |
4882 return false; |
5768 |
4883 } // A post is not autosavable when there is a post autosave lock. |
5769 |
4884 |
5770 if (!hasAutosave(state)) { |
4885 |
5771 return true; |
4886 if (isPostAutosavingLocked(state)) { |
5772 } // To avoid an expensive content serialization, use the content dirtiness |
4887 return false; |
5773 // flag in place of content field comparison against the known autosave. |
4888 } |
5774 // This is not strictly accurate, and relies on a tolerance toward autosave |
4889 |
5775 // request failures for unnecessary saves. |
4890 var postType = selectors_getCurrentPostType(state); |
5776 |
4891 var postId = selectors_getCurrentPostId(state); |
5777 |
4892 var hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId); |
5778 if (hasChangedContent(state)) { |
4893 var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave |
5779 return true; |
4894 // via a resolver, moving below the return would result in the autosave never |
5780 } // If the title, excerpt or content has changed, the post is autosaveable. |
4895 // being fetched. |
5781 |
4896 // eslint-disable-next-line @wordpress/no-unused-vars-before-return |
5782 |
4897 |
5783 var autosave = getAutosave(state); |
4898 var autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is |
5784 return ['title', 'excerpt'].some(function (field) { |
4899 // unable to determine if the post is autosaveable, so return false. |
5785 return autosave[field] !== selectors_getEditedPostAttribute(state, field); |
4900 |
5786 }); |
4901 if (!hasFetchedAutosave) { |
5787 } |
4902 return false; |
4903 } // If we don't already have an autosave, the post is autosaveable. |
|
4904 |
|
4905 |
|
4906 if (!autosave) { |
|
4907 return true; |
|
4908 } // To avoid an expensive content serialization, use the content dirtiness |
|
4909 // flag in place of content field comparison against the known autosave. |
|
4910 // This is not strictly accurate, and relies on a tolerance toward autosave |
|
4911 // request failures for unnecessary saves. |
|
4912 |
|
4913 |
|
4914 if (hasChangedContent(state)) { |
|
4915 return true; |
|
4916 } // If the title or excerpt has changed, the post is autosaveable. |
|
4917 |
|
4918 |
|
4919 return ['title', 'excerpt'].some(function (field) { |
|
4920 return getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field); |
|
4921 }); |
|
4922 }; |
|
4923 }); |
|
5788 /** |
4924 /** |
5789 * Returns the current autosave, or null if one is not set (i.e. if the post |
4925 * Returns the current autosave, or null if one is not set (i.e. if the post |
5790 * has yet to be autosaved, or has been saved or published since the last |
4926 * has yet to be autosaved, or has been saved or published since the last |
5791 * autosave). |
4927 * autosave). |
5792 * |
4928 * |
4929 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` |
|
4930 * selector from the '@wordpress/core-data' package. |
|
4931 * |
|
5793 * @param {Object} state Editor state. |
4932 * @param {Object} state Editor state. |
5794 * |
4933 * |
5795 * @return {?Object} Current autosave, if exists. |
4934 * @return {?Object} Current autosave, if exists. |
5796 */ |
4935 */ |
5797 |
4936 |
5798 function getAutosave(state) { |
4937 var getAutosave = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5799 return state.autosave; |
4938 return function (state) { |
5800 } |
4939 external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getAutosave()`", { |
4940 alternative: "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`", |
|
4941 plugin: 'Gutenberg' |
|
4942 }); |
|
4943 var postType = selectors_getCurrentPostType(state); |
|
4944 var postId = selectors_getCurrentPostId(state); |
|
4945 var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); |
|
4946 var autosave = select('core').getAutosave(postType, postId, currentUserId); |
|
4947 return Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue); |
|
4948 }; |
|
4949 }); |
|
5801 /** |
4950 /** |
5802 * Returns the true if there is an existing autosave, otherwise false. |
4951 * Returns the true if there is an existing autosave, otherwise false. |
5803 * |
4952 * |
4953 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector |
|
4954 * from the '@wordpress/core-data' package and check for a truthy value. |
|
4955 * |
|
5804 * @param {Object} state Global application state. |
4956 * @param {Object} state Global application state. |
5805 * |
4957 * |
5806 * @return {boolean} Whether there is an existing autosave. |
4958 * @return {boolean} Whether there is an existing autosave. |
5807 */ |
4959 */ |
5808 |
4960 |
5809 function hasAutosave(state) { |
4961 var hasAutosave = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5810 return !!getAutosave(state); |
4962 return function (state) { |
5811 } |
4963 external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' ).hasAutosave()`", { |
4964 alternative: "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`", |
|
4965 plugin: 'Gutenberg' |
|
4966 }); |
|
4967 var postType = selectors_getCurrentPostType(state); |
|
4968 var postId = selectors_getCurrentPostId(state); |
|
4969 var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); |
|
4970 return !!select('core').getAutosave(postType, postId, currentUserId); |
|
4971 }; |
|
4972 }); |
|
5812 /** |
4973 /** |
5813 * Return true if the post being edited is being scheduled. Preferring the |
4974 * Return true if the post being edited is being scheduled. Preferring the |
5814 * unsaved status values. |
4975 * unsaved status values. |
5815 * |
4976 * |
5816 * @param {Object} state Global application state. |
4977 * @param {Object} state Global application state. |
5831 * Unlike in the PHP backend, the REST API returns a full date string for posts |
4992 * Unlike in the PHP backend, the REST API returns a full date string for posts |
5832 * where the 0000-00-00T00:00:00 placeholder is present in the database. To |
4993 * where the 0000-00-00T00:00:00 placeholder is present in the database. To |
5833 * infer that a post is set to publish "Immediately" we check whether the date |
4994 * infer that a post is set to publish "Immediately" we check whether the date |
5834 * and modified date are the same. |
4995 * and modified date are the same. |
5835 * |
4996 * |
5836 * @param {Object} state Editor state. |
4997 * @param {Object} state Editor state. |
5837 * |
4998 * |
5838 * @return {boolean} Whether the edited post has a floating date value. |
4999 * @return {boolean} Whether the edited post has a floating date value. |
5839 */ |
5000 */ |
5840 |
5001 |
5841 function isEditedPostDateFloating(state) { |
5002 function isEditedPostDateFloating(state) { |
5842 var date = selectors_getEditedPostAttribute(state, 'date'); |
5003 var date = selectors_getEditedPostAttribute(state, 'date'); |
5843 var modified = selectors_getEditedPostAttribute(state, 'modified'); |
5004 var modified = selectors_getEditedPostAttribute(state, 'modified'); |
5844 var status = selectors_getEditedPostAttribute(state, 'status'); |
5005 var status = selectors_getEditedPostAttribute(state, 'status'); |
5845 |
5006 |
5846 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { |
5007 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { |
5847 return date === modified; |
5008 return date === modified || date === null; |
5848 } |
5009 } |
5849 |
5010 |
5850 return false; |
5011 return false; |
5851 } |
5012 } |
5852 /** |
5013 /** |
5855 * @param {Object} state Global application state. |
5016 * @param {Object} state Global application state. |
5856 * |
5017 * |
5857 * @return {boolean} Whether post is being saved. |
5018 * @return {boolean} Whether post is being saved. |
5858 */ |
5019 */ |
5859 |
5020 |
5860 function selectors_isSavingPost(state) { |
5021 var selectors_isSavingPost = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5861 return state.saving.requesting; |
5022 return function (state) { |
5862 } |
5023 var postType = selectors_getCurrentPostType(state); |
5024 var postId = selectors_getCurrentPostId(state); |
|
5025 return select('core').isSavingEntityRecord('postType', postType, postId); |
|
5026 }; |
|
5027 }); |
|
5863 /** |
5028 /** |
5864 * Returns true if a previous post save was attempted successfully, or false |
5029 * Returns true if a previous post save was attempted successfully, or false |
5865 * otherwise. |
5030 * otherwise. |
5866 * |
5031 * |
5867 * @param {Object} state Global application state. |
5032 * @param {Object} state Global application state. |
5868 * |
5033 * |
5869 * @return {boolean} Whether the post was saved successfully. |
5034 * @return {boolean} Whether the post was saved successfully. |
5870 */ |
5035 */ |
5871 |
5036 |
5872 function didPostSaveRequestSucceed(state) { |
5037 var didPostSaveRequestSucceed = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5873 return state.saving.successful; |
5038 return function (state) { |
5874 } |
5039 var postType = selectors_getCurrentPostType(state); |
5040 var postId = selectors_getCurrentPostId(state); |
|
5041 return !select('core').getLastEntitySaveError('postType', postType, postId); |
|
5042 }; |
|
5043 }); |
|
5875 /** |
5044 /** |
5876 * Returns true if a previous post save was attempted but failed, or false |
5045 * Returns true if a previous post save was attempted but failed, or false |
5877 * otherwise. |
5046 * otherwise. |
5878 * |
5047 * |
5879 * @param {Object} state Global application state. |
5048 * @param {Object} state Global application state. |
5880 * |
5049 * |
5881 * @return {boolean} Whether the post save failed. |
5050 * @return {boolean} Whether the post save failed. |
5882 */ |
5051 */ |
5883 |
5052 |
5884 function didPostSaveRequestFail(state) { |
5053 var didPostSaveRequestFail = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5885 return !!state.saving.error; |
5054 return function (state) { |
5886 } |
5055 var postType = selectors_getCurrentPostType(state); |
5056 var postId = selectors_getCurrentPostId(state); |
|
5057 return !!select('core').getLastEntitySaveError('postType', postType, postId); |
|
5058 }; |
|
5059 }); |
|
5887 /** |
5060 /** |
5888 * Returns true if the post is autosaving, or false otherwise. |
5061 * Returns true if the post is autosaving, or false otherwise. |
5889 * |
5062 * |
5890 * @param {Object} state Global application state. |
5063 * @param {Object} state Global application state. |
5891 * |
5064 * |
5892 * @return {boolean} Whether the post is autosaving. |
5065 * @return {boolean} Whether the post is autosaving. |
5893 */ |
5066 */ |
5894 |
5067 |
5895 function selectors_isAutosavingPost(state) { |
5068 function selectors_isAutosavingPost(state) { |
5896 return selectors_isSavingPost(state) && !!state.saving.options.isAutosave; |
5069 if (!selectors_isSavingPost(state)) { |
5070 return false; |
|
5071 } |
|
5072 |
|
5073 return !!Object(external_this_lodash_["get"])(state.saving, ['options', 'isAutosave']); |
|
5897 } |
5074 } |
5898 /** |
5075 /** |
5899 * Returns true if the post is being previewed, or false otherwise. |
5076 * Returns true if the post is being previewed, or false otherwise. |
5900 * |
5077 * |
5901 * @param {Object} state Global application state. |
5078 * @param {Object} state Global application state. |
5902 * |
5079 * |
5903 * @return {boolean} Whether the post is being previewed. |
5080 * @return {boolean} Whether the post is being previewed. |
5904 */ |
5081 */ |
5905 |
5082 |
5906 function isPreviewingPost(state) { |
5083 function isPreviewingPost(state) { |
5907 return selectors_isSavingPost(state) && !!state.saving.options.isPreview; |
5084 if (!selectors_isSavingPost(state)) { |
5085 return false; |
|
5086 } |
|
5087 |
|
5088 return !!state.saving.options.isPreview; |
|
5908 } |
5089 } |
5909 /** |
5090 /** |
5910 * Returns the post preview link |
5091 * Returns the post preview link |
5911 * |
5092 * |
5912 * @param {Object} state Global application state. |
5093 * @param {Object} state Global application state. |
5913 * |
5094 * |
5914 * @return {string?} Preview Link. |
5095 * @return {string?} Preview Link. |
5915 */ |
5096 */ |
5916 |
5097 |
5917 function selectors_getEditedPostPreviewLink(state) { |
5098 function selectors_getEditedPostPreviewLink(state) { |
5099 if (state.saving.pending || selectors_isSavingPost(state)) { |
|
5100 return; |
|
5101 } |
|
5102 |
|
5103 var previewLink = getAutosaveAttribute(state, 'preview_link'); |
|
5104 |
|
5105 if (!previewLink) { |
|
5106 previewLink = selectors_getEditedPostAttribute(state, 'link'); |
|
5107 |
|
5108 if (previewLink) { |
|
5109 previewLink = Object(external_this_wp_url_["addQueryArgs"])(previewLink, { |
|
5110 preview: true |
|
5111 }); |
|
5112 } |
|
5113 } |
|
5114 |
|
5918 var featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media'); |
5115 var featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media'); |
5919 var previewLink = state.previewLink; |
|
5920 |
5116 |
5921 if (previewLink && featuredImageId) { |
5117 if (previewLink && featuredImageId) { |
5922 return Object(external_this_wp_url_["addQueryArgs"])(previewLink, { |
5118 return Object(external_this_wp_url_["addQueryArgs"])(previewLink, { |
5923 _thumbnail_id: featuredImageId |
5119 _thumbnail_id: featuredImageId |
5924 }); |
5120 }); |
5935 * |
5131 * |
5936 * @return {?string} Suggested post format. |
5132 * @return {?string} Suggested post format. |
5937 */ |
5133 */ |
5938 |
5134 |
5939 function selectors_getSuggestedPostFormat(state) { |
5135 function selectors_getSuggestedPostFormat(state) { |
5940 var blocks = state.editor.present.blocks.value; |
5136 var blocks = selectors_getEditorBlocks(state); |
5941 var name; // If there is only one block in the content of the post grab its name |
5137 var name; // If there is only one block in the content of the post grab its name |
5942 // so we can derive a suitable post format from it. |
5138 // so we can derive a suitable post format from it. |
5943 |
5139 |
5944 if (blocks.length === 1) { |
5140 if (blocks.length === 1) { |
5945 name = blocks[0].name; |
5141 name = blocks[0].name; |
5980 } |
5176 } |
5981 /** |
5177 /** |
5982 * Returns a set of blocks which are to be used in consideration of the post's |
5178 * Returns a set of blocks which are to be used in consideration of the post's |
5983 * generated save content. |
5179 * generated save content. |
5984 * |
5180 * |
5181 * @deprecated since Gutenberg 6.2.0. |
|
5182 * |
|
5985 * @param {Object} state Editor state. |
5183 * @param {Object} state Editor state. |
5986 * |
5184 * |
5987 * @return {WPBlock[]} Filtered set of blocks for save. |
5185 * @return {WPBlock[]} Filtered set of blocks for save. |
5988 */ |
5186 */ |
5989 |
5187 |
5990 function getBlocksForSerialization(state) { |
5188 function getBlocksForSerialization(state) { |
5189 external_this_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', { |
|
5190 plugin: 'Gutenberg', |
|
5191 alternative: 'getEditorBlocks', |
|
5192 hint: 'Blocks serialization pre-processing occurs at save time' |
|
5193 }); |
|
5991 var blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified |
5194 var blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified |
5992 // against the implementation of isEditedPostEmpty, which bypasses this |
5195 // against the implementation of isEditedPostEmpty, which bypasses this |
5993 // function for performance' sake, in an assumption of this current logic |
5196 // function for performance' sake, in an assumption of this current logic |
5994 // being irrelevant to the optimized condition of emptiness. |
5197 // being irrelevant to the optimized condition of emptiness. |
5995 // A single unmodified default block is assumed to be equivalent to an |
5198 // A single unmodified default block is assumed to be equivalent to an |
6002 } |
5205 } |
6003 |
5206 |
6004 return blocks; |
5207 return blocks; |
6005 } |
5208 } |
6006 /** |
5209 /** |
6007 * Returns the content of the post being edited, preferring raw string edit |
5210 * Returns the content of the post being edited. |
6008 * before falling back to serialization of block state. |
|
6009 * |
5211 * |
6010 * @param {Object} state Global application state. |
5212 * @param {Object} state Global application state. |
6011 * |
5213 * |
6012 * @return {string} Post content. |
5214 * @return {string} Post content. |
6013 */ |
5215 */ |
6014 |
5216 |
6015 var getEditedPostContent = Object(rememo["a" /* default */])(function (state) { |
5217 var getEditedPostContent = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
6016 var edits = getPostEdits(state); |
5218 return function (state) { |
6017 |
5219 var postId = selectors_getCurrentPostId(state); |
6018 if ('content' in edits) { |
5220 var postType = selectors_getCurrentPostType(state); |
6019 return edits.content; |
5221 var record = select('core').getEditedEntityRecord('postType', postType, postId); |
6020 } |
5222 |
6021 |
5223 if (record) { |
6022 var blocks = getBlocksForSerialization(state); |
5224 if (typeof record.content === 'function') { |
6023 var content = Object(external_this_wp_blocks_["serialize"])(blocks); // For compatibility purposes, treat a post consisting of a single |
5225 return record.content(record); |
6024 // freeform block as legacy content and downgrade to a pre-block-editor |
5226 } else if (record.blocks) { |
6025 // removep'd content format. |
5227 return serialize_blocks(record.blocks); |
6026 |
5228 } else if (record.content) { |
6027 var isSingleFreeformBlock = blocks.length === 1 && blocks[0].name === Object(external_this_wp_blocks_["getFreeformContentHandlerName"])(); |
5229 return record.content; |
6028 |
5230 } |
6029 if (isSingleFreeformBlock) { |
5231 } |
6030 return Object(external_this_wp_autop_["removep"])(content); |
5232 |
6031 } |
5233 return ''; |
6032 |
5234 }; |
6033 return content; |
|
6034 }, function (state) { |
|
6035 return [state.editor.present.blocks.value, state.editor.present.edits.content, state.initialEdits.content]; |
|
6036 }); |
5235 }); |
6037 /** |
5236 /** |
6038 * Returns the reusable block with the given ID. |
5237 * Returns the reusable block with the given ID. |
6039 * |
5238 * |
6040 * @param {Object} state Global application state. |
5239 * @param {Object} state Global application state. |
6049 if (!block) { |
5248 if (!block) { |
6050 return null; |
5249 return null; |
6051 } |
5250 } |
6052 |
5251 |
6053 var isTemporary = isNaN(parseInt(ref)); |
5252 var isTemporary = isNaN(parseInt(ref)); |
6054 return Object(objectSpread["a" /* default */])({}, block, { |
5253 return selectors_objectSpread({}, block, { |
6055 id: isTemporary ? ref : +ref, |
5254 id: isTemporary ? ref : +ref, |
6056 isTemporary: isTemporary |
5255 isTemporary: isTemporary |
6057 }); |
5256 }); |
6058 }, function (state, ref) { |
5257 }, function (state, ref) { |
6059 return [state.reusableBlocks.data[ref]]; |
5258 return [state.reusableBlocks.data[ref]]; |
6089 * @param {Object} state Global application state. |
5288 * @param {Object} state Global application state. |
6090 * |
5289 * |
6091 * @return {Array} An array of all reusable blocks. |
5290 * @return {Array} An array of all reusable blocks. |
6092 */ |
5291 */ |
6093 |
5292 |
6094 var __experimentalGetReusableBlocks = Object(rememo["a" /* default */])(function (state) { |
5293 var selectors_experimentalGetReusableBlocks = Object(rememo["a" /* default */])(function (state) { |
6095 return Object(external_lodash_["map"])(state.reusableBlocks.data, function (value, ref) { |
5294 return Object(external_this_lodash_["map"])(state.reusableBlocks.data, function (value, ref) { |
6096 return __experimentalGetReusableBlock(state, ref); |
5295 return __experimentalGetReusableBlock(state, ref); |
6097 }); |
5296 }); |
6098 }, function (state) { |
5297 }, function (state) { |
6099 return [state.reusableBlocks.data]; |
5298 return [state.reusableBlocks.data]; |
6100 }); |
5299 }); |
6107 * |
5306 * |
6108 * @return {Object} Global application state prior to transaction. |
5307 * @return {Object} Global application state prior to transaction. |
6109 */ |
5308 */ |
6110 |
5309 |
6111 function getStateBeforeOptimisticTransaction(state, transactionId) { |
5310 function getStateBeforeOptimisticTransaction(state, transactionId) { |
6112 var transaction = Object(external_lodash_["find"])(state.optimist, function (entry) { |
5311 var transaction = Object(external_this_lodash_["find"])(state.optimist, function (entry) { |
6113 return entry.beforeState && Object(external_lodash_["get"])(entry.action, ['optimist', 'id']) === transactionId; |
5312 return entry.beforeState && Object(external_this_lodash_["get"])(entry.action, ['optimist', 'id']) === transactionId; |
6114 }); |
5313 }); |
6115 return transaction ? transaction.beforeState : null; |
5314 return transaction ? transaction.beforeState : null; |
6116 } |
5315 } |
6117 /** |
5316 /** |
6118 * Returns true if the post is being published, or false otherwise. |
5317 * Returns true if the post is being published, or false otherwise. |
6136 |
5335 |
6137 |
5336 |
6138 var stateBeforeRequest = getStateBeforeOptimisticTransaction(state, POST_UPDATE_TRANSACTION_ID); // Consider as publishing when current post prior to request was not |
5337 var stateBeforeRequest = getStateBeforeOptimisticTransaction(state, POST_UPDATE_TRANSACTION_ID); // Consider as publishing when current post prior to request was not |
6139 // considered published |
5338 // considered published |
6140 |
5339 |
6141 return !!stateBeforeRequest && !selectors_isCurrentPostPublished(stateBeforeRequest); |
5340 return !!stateBeforeRequest && !selectors_isCurrentPostPublished(null, stateBeforeRequest.currentPost); |
6142 } |
5341 } |
6143 /** |
5342 /** |
6144 * Returns whether the permalink is editable or not. |
5343 * Returns whether the permalink is editable or not. |
6145 * |
5344 * |
6146 * @param {Object} state Editor state. |
5345 * @param {Object} state Editor state. |
6147 * |
5346 * |
6148 * @return {boolean} Whether or not the permalink is editable. |
5347 * @return {boolean} Whether or not the permalink is editable. |
6149 */ |
5348 */ |
6150 |
5349 |
6151 function selectors_isPermalinkEditable(state) { |
5350 function isPermalinkEditable(state) { |
6152 var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); |
5351 var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); |
6153 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); |
5352 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); |
6154 } |
5353 } |
6155 /** |
5354 /** |
6156 * Returns the permalink for the post. |
5355 * Returns the permalink for the post. |
6159 * |
5358 * |
6160 * @return {?string} The permalink, or null if the post is not viewable. |
5359 * @return {?string} The permalink, or null if the post is not viewable. |
6161 */ |
5360 */ |
6162 |
5361 |
6163 function getPermalink(state) { |
5362 function getPermalink(state) { |
6164 var permalinkParts = selectors_getPermalinkParts(state); |
5363 var permalinkParts = getPermalinkParts(state); |
6165 |
5364 |
6166 if (!permalinkParts) { |
5365 if (!permalinkParts) { |
6167 return null; |
5366 return null; |
6168 } |
5367 } |
6169 |
5368 |
6170 var prefix = permalinkParts.prefix, |
5369 var prefix = permalinkParts.prefix, |
6171 postName = permalinkParts.postName, |
5370 postName = permalinkParts.postName, |
6172 suffix = permalinkParts.suffix; |
5371 suffix = permalinkParts.suffix; |
6173 |
5372 |
6174 if (selectors_isPermalinkEditable(state)) { |
5373 if (isPermalinkEditable(state)) { |
6175 return prefix + postName + suffix; |
5374 return prefix + postName + suffix; |
6176 } |
5375 } |
6177 |
5376 |
6178 return prefix; |
5377 return prefix; |
6179 } |
5378 } |
6180 /** |
5379 /** |
5380 * Returns the slug for the post being edited, preferring a manually edited |
|
5381 * value if one exists, then a sanitized version of the current post title, and |
|
5382 * finally the post ID. |
|
5383 * |
|
5384 * @param {Object} state Editor state. |
|
5385 * |
|
5386 * @return {string} The current slug to be displayed in the editor |
|
5387 */ |
|
5388 |
|
5389 function getEditedPostSlug(state) { |
|
5390 return selectors_getEditedPostAttribute(state, 'slug') || cleanForSlug(selectors_getEditedPostAttribute(state, 'title')) || selectors_getCurrentPostId(state); |
|
5391 } |
|
5392 /** |
|
6181 * Returns the permalink for a post, split into it's three parts: the prefix, |
5393 * Returns the permalink for a post, split into it's three parts: the prefix, |
6182 * the postName, and the suffix. |
5394 * the postName, and the suffix. |
6183 * |
5395 * |
6184 * @param {Object} state Editor state. |
5396 * @param {Object} state Editor state. |
6185 * |
5397 * |
6186 * @return {Object} An object containing the prefix, postName, and suffix for |
5398 * @return {Object} An object containing the prefix, postName, and suffix for |
6187 * the permalink, or null if the post is not viewable. |
5399 * the permalink, or null if the post is not viewable. |
6188 */ |
5400 */ |
6189 |
5401 |
6190 function selectors_getPermalinkParts(state) { |
5402 function getPermalinkParts(state) { |
6191 var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); |
5403 var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); |
6192 |
5404 |
6193 if (!permalinkTemplate) { |
5405 if (!permalinkTemplate) { |
6194 return null; |
5406 return null; |
6195 } |
5407 } |
6250 |
5462 |
6251 function selectors_isPostSavingLocked(state) { |
5463 function selectors_isPostSavingLocked(state) { |
6252 return Object.keys(state.postSavingLock).length > 0; |
5464 return Object.keys(state.postSavingLock).length > 0; |
6253 } |
5465 } |
6254 /** |
5466 /** |
5467 * Returns whether post autosaving is locked. |
|
5468 * |
|
5469 * @param {Object} state Global application state. |
|
5470 * |
|
5471 * @return {boolean} Is locked. |
|
5472 */ |
|
5473 |
|
5474 function isPostAutosavingLocked(state) { |
|
5475 return Object.keys(state.postAutosavingLock).length > 0; |
|
5476 } |
|
5477 /** |
|
6255 * Returns whether the edition of the post has been taken over. |
5478 * Returns whether the edition of the post has been taken over. |
6256 * |
5479 * |
6257 * @param {Object} state Global application state. |
5480 * @param {Object} state Global application state. |
6258 * |
5481 * |
6259 * @return {boolean} Is post lock takeover. |
5482 * @return {boolean} Is post lock takeover. |
6290 * @param {Object} state Editor state. |
5513 * @param {Object} state Editor state. |
6291 * |
5514 * |
6292 * @return {boolean} Whether the user can or can't post unfiltered HTML. |
5515 * @return {boolean} Whether the user can or can't post unfiltered HTML. |
6293 */ |
5516 */ |
6294 |
5517 |
6295 function canUserUseUnfilteredHTML(state) { |
5518 function selectors_canUserUseUnfilteredHTML(state) { |
6296 return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); |
5519 return Object(external_this_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); |
6297 } |
5520 } |
6298 /** |
5521 /** |
6299 * Returns whether the pre-publish panel should be shown |
5522 * Returns whether the pre-publish panel should be shown |
6300 * or skipped when the user clicks the "publish" button. |
5523 * or skipped when the user clicks the "publish" button. |
6301 * |
5524 * |
6316 * |
5539 * |
6317 * @param {Object} state |
5540 * @param {Object} state |
6318 * @return {Array} Block list. |
5541 * @return {Array} Block list. |
6319 */ |
5542 */ |
6320 |
5543 |
6321 function getEditorBlocks(state) { |
5544 function selectors_getEditorBlocks(state) { |
6322 return state.editor.present.blocks.value; |
5545 return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY; |
5546 } |
|
5547 /** |
|
5548 * A block selection object. |
|
5549 * |
|
5550 * @typedef {Object} WPBlockSelection |
|
5551 * |
|
5552 * @property {string} clientId A block client ID. |
|
5553 * @property {string} attributeKey A block attribute key. |
|
5554 * @property {number} offset An attribute value offset, based on the rich |
|
5555 * text value. See `wp.richText.create`. |
|
5556 */ |
|
5557 |
|
5558 /** |
|
5559 * Returns the current selection start. |
|
5560 * |
|
5561 * @param {Object} state |
|
5562 * @return {WPBlockSelection} The selection start. |
|
5563 */ |
|
5564 |
|
5565 function selectors_getEditorSelectionStart(state) { |
|
5566 return selectors_getEditedPostAttribute(state, 'selectionStart'); |
|
5567 } |
|
5568 /** |
|
5569 * Returns the current selection end. |
|
5570 * |
|
5571 * @param {Object} state |
|
5572 * @return {WPBlockSelection} The selection end. |
|
5573 */ |
|
5574 |
|
5575 function selectors_getEditorSelectionEnd(state) { |
|
5576 return selectors_getEditedPostAttribute(state, 'selectionEnd'); |
|
6323 } |
5577 } |
6324 /** |
5578 /** |
6325 * Is the editor ready |
5579 * Is the editor ready |
6326 * |
5580 * |
6327 * @param {Object} state |
5581 * @param {Object} state |
6349 function getBlockEditorSelector(name) { |
5603 function getBlockEditorSelector(name) { |
6350 return Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
5604 return Object(external_this_wp_data_["createRegistrySelector"])(function (select) { |
6351 return function (state) { |
5605 return function (state) { |
6352 var _select; |
5606 var _select; |
6353 |
5607 |
5608 external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { |
|
5609 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`' |
|
5610 }); |
|
5611 |
|
6354 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
5612 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
6355 args[_key - 1] = arguments[_key]; |
5613 args[_key - 1] = arguments[_key]; |
6356 } |
5614 } |
6357 |
5615 |
6358 return (_select = select('core/block-editor'))[name].apply(_select, args); |
5616 return (_select = select('core/block-editor'))[name].apply(_select, args); |
6359 }; |
5617 }; |
6360 }); |
5618 }); |
6361 } |
5619 } |
6362 |
5620 /** |
6363 var getBlockDependantsCacheBust = getBlockEditorSelector('getBlockDependantsCacheBust'); |
5621 * @see getBlockName in core/block-editor store. |
6364 var selectors_getBlockName = getBlockEditorSelector('getBlockName'); |
5622 */ |
5623 |
|
5624 |
|
5625 var getBlockName = getBlockEditorSelector('getBlockName'); |
|
5626 /** |
|
5627 * @see isBlockValid in core/block-editor store. |
|
5628 */ |
|
5629 |
|
6365 var isBlockValid = getBlockEditorSelector('isBlockValid'); |
5630 var isBlockValid = getBlockEditorSelector('isBlockValid'); |
5631 /** |
|
5632 * @see getBlockAttributes in core/block-editor store. |
|
5633 */ |
|
5634 |
|
6366 var getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); |
5635 var getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); |
6367 var getBlock = getBlockEditorSelector('getBlock'); |
5636 /** |
5637 * @see getBlock in core/block-editor store. |
|
5638 */ |
|
5639 |
|
5640 var selectors_getBlock = getBlockEditorSelector('getBlock'); |
|
5641 /** |
|
5642 * @see getBlocks in core/block-editor store. |
|
5643 */ |
|
5644 |
|
6368 var selectors_getBlocks = getBlockEditorSelector('getBlocks'); |
5645 var selectors_getBlocks = getBlockEditorSelector('getBlocks'); |
5646 /** |
|
5647 * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store. |
|
5648 */ |
|
5649 |
|
6369 var __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks'); |
5650 var __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks'); |
5651 /** |
|
5652 * @see getClientIdsOfDescendants in core/block-editor store. |
|
5653 */ |
|
5654 |
|
6370 var getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); |
5655 var getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); |
5656 /** |
|
5657 * @see getClientIdsWithDescendants in core/block-editor store. |
|
5658 */ |
|
5659 |
|
6371 var getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); |
5660 var getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); |
5661 /** |
|
5662 * @see getGlobalBlockCount in core/block-editor store. |
|
5663 */ |
|
5664 |
|
6372 var getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); |
5665 var getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); |
6373 var getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); |
5666 /** |
5667 * @see getBlocksByClientId in core/block-editor store. |
|
5668 */ |
|
5669 |
|
5670 var selectors_getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); |
|
5671 /** |
|
5672 * @see getBlockCount in core/block-editor store. |
|
5673 */ |
|
5674 |
|
6374 var getBlockCount = getBlockEditorSelector('getBlockCount'); |
5675 var getBlockCount = getBlockEditorSelector('getBlockCount'); |
5676 /** |
|
5677 * @see getBlockSelectionStart in core/block-editor store. |
|
5678 */ |
|
5679 |
|
6375 var getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); |
5680 var getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); |
5681 /** |
|
5682 * @see getBlockSelectionEnd in core/block-editor store. |
|
5683 */ |
|
5684 |
|
6376 var getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); |
5685 var getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); |
5686 /** |
|
5687 * @see getSelectedBlockCount in core/block-editor store. |
|
5688 */ |
|
5689 |
|
6377 var getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); |
5690 var getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); |
5691 /** |
|
5692 * @see hasSelectedBlock in core/block-editor store. |
|
5693 */ |
|
5694 |
|
6378 var hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); |
5695 var hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); |
6379 var selectors_getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); |
5696 /** |
5697 * @see getSelectedBlockClientId in core/block-editor store. |
|
5698 */ |
|
5699 |
|
5700 var getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); |
|
5701 /** |
|
5702 * @see getSelectedBlock in core/block-editor store. |
|
5703 */ |
|
5704 |
|
6380 var getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); |
5705 var getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); |
5706 /** |
|
5707 * @see getBlockRootClientId in core/block-editor store. |
|
5708 */ |
|
5709 |
|
6381 var getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); |
5710 var getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); |
5711 /** |
|
5712 * @see getBlockHierarchyRootClientId in core/block-editor store. |
|
5713 */ |
|
5714 |
|
6382 var getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); |
5715 var getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); |
5716 /** |
|
5717 * @see getAdjacentBlockClientId in core/block-editor store. |
|
5718 */ |
|
5719 |
|
6383 var getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); |
5720 var getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); |
5721 /** |
|
5722 * @see getPreviousBlockClientId in core/block-editor store. |
|
5723 */ |
|
5724 |
|
6384 var getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); |
5725 var getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); |
5726 /** |
|
5727 * @see getNextBlockClientId in core/block-editor store. |
|
5728 */ |
|
5729 |
|
6385 var getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); |
5730 var getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); |
5731 /** |
|
5732 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. |
|
5733 */ |
|
5734 |
|
6386 var getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); |
5735 var getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); |
5736 /** |
|
5737 * @see getMultiSelectedBlockClientIds in core/block-editor store. |
|
5738 */ |
|
5739 |
|
6387 var getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); |
5740 var getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); |
5741 /** |
|
5742 * @see getMultiSelectedBlocks in core/block-editor store. |
|
5743 */ |
|
5744 |
|
6388 var getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); |
5745 var getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); |
5746 /** |
|
5747 * @see getFirstMultiSelectedBlockClientId in core/block-editor store. |
|
5748 */ |
|
5749 |
|
6389 var getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); |
5750 var getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); |
5751 /** |
|
5752 * @see getLastMultiSelectedBlockClientId in core/block-editor store. |
|
5753 */ |
|
5754 |
|
6390 var getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); |
5755 var getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); |
5756 /** |
|
5757 * @see isFirstMultiSelectedBlock in core/block-editor store. |
|
5758 */ |
|
5759 |
|
6391 var isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); |
5760 var isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); |
5761 /** |
|
5762 * @see isBlockMultiSelected in core/block-editor store. |
|
5763 */ |
|
5764 |
|
6392 var isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); |
5765 var isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); |
5766 /** |
|
5767 * @see isAncestorMultiSelected in core/block-editor store. |
|
5768 */ |
|
5769 |
|
6393 var isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); |
5770 var isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); |
5771 /** |
|
5772 * @see getMultiSelectedBlocksStartClientId in core/block-editor store. |
|
5773 */ |
|
5774 |
|
6394 var getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); |
5775 var getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); |
5776 /** |
|
5777 * @see getMultiSelectedBlocksEndClientId in core/block-editor store. |
|
5778 */ |
|
5779 |
|
6395 var getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); |
5780 var getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); |
5781 /** |
|
5782 * @see getBlockOrder in core/block-editor store. |
|
5783 */ |
|
5784 |
|
6396 var getBlockOrder = getBlockEditorSelector('getBlockOrder'); |
5785 var getBlockOrder = getBlockEditorSelector('getBlockOrder'); |
5786 /** |
|
5787 * @see getBlockIndex in core/block-editor store. |
|
5788 */ |
|
5789 |
|
6397 var getBlockIndex = getBlockEditorSelector('getBlockIndex'); |
5790 var getBlockIndex = getBlockEditorSelector('getBlockIndex'); |
5791 /** |
|
5792 * @see isBlockSelected in core/block-editor store. |
|
5793 */ |
|
5794 |
|
6398 var isBlockSelected = getBlockEditorSelector('isBlockSelected'); |
5795 var isBlockSelected = getBlockEditorSelector('isBlockSelected'); |
5796 /** |
|
5797 * @see hasSelectedInnerBlock in core/block-editor store. |
|
5798 */ |
|
5799 |
|
6399 var hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); |
5800 var hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); |
5801 /** |
|
5802 * @see isBlockWithinSelection in core/block-editor store. |
|
5803 */ |
|
5804 |
|
6400 var isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); |
5805 var isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); |
5806 /** |
|
5807 * @see hasMultiSelection in core/block-editor store. |
|
5808 */ |
|
5809 |
|
6401 var hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); |
5810 var hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); |
5811 /** |
|
5812 * @see isMultiSelecting in core/block-editor store. |
|
5813 */ |
|
5814 |
|
6402 var isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); |
5815 var isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); |
5816 /** |
|
5817 * @see isSelectionEnabled in core/block-editor store. |
|
5818 */ |
|
5819 |
|
6403 var isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); |
5820 var isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); |
5821 /** |
|
5822 * @see getBlockMode in core/block-editor store. |
|
5823 */ |
|
5824 |
|
6404 var getBlockMode = getBlockEditorSelector('getBlockMode'); |
5825 var getBlockMode = getBlockEditorSelector('getBlockMode'); |
6405 var selectors_isTyping = getBlockEditorSelector('isTyping'); |
5826 /** |
6406 var selectors_isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); |
5827 * @see isTyping in core/block-editor store. |
5828 */ |
|
5829 |
|
5830 var isTyping = getBlockEditorSelector('isTyping'); |
|
5831 /** |
|
5832 * @see isCaretWithinFormattedText in core/block-editor store. |
|
5833 */ |
|
5834 |
|
5835 var isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); |
|
5836 /** |
|
5837 * @see getBlockInsertionPoint in core/block-editor store. |
|
5838 */ |
|
5839 |
|
6407 var getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); |
5840 var getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); |
5841 /** |
|
5842 * @see isBlockInsertionPointVisible in core/block-editor store. |
|
5843 */ |
|
5844 |
|
6408 var isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); |
5845 var isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); |
5846 /** |
|
5847 * @see isValidTemplate in core/block-editor store. |
|
5848 */ |
|
5849 |
|
6409 var isValidTemplate = getBlockEditorSelector('isValidTemplate'); |
5850 var isValidTemplate = getBlockEditorSelector('isValidTemplate'); |
5851 /** |
|
5852 * @see getTemplate in core/block-editor store. |
|
5853 */ |
|
5854 |
|
6410 var getTemplate = getBlockEditorSelector('getTemplate'); |
5855 var getTemplate = getBlockEditorSelector('getTemplate'); |
5856 /** |
|
5857 * @see getTemplateLock in core/block-editor store. |
|
5858 */ |
|
5859 |
|
6411 var getTemplateLock = getBlockEditorSelector('getTemplateLock'); |
5860 var getTemplateLock = getBlockEditorSelector('getTemplateLock'); |
6412 var canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); |
5861 /** |
6413 var selectors_getInserterItems = getBlockEditorSelector('getInserterItems'); |
5862 * @see canInsertBlockType in core/block-editor store. |
5863 */ |
|
5864 |
|
5865 var selectors_canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); |
|
5866 /** |
|
5867 * @see getInserterItems in core/block-editor store. |
|
5868 */ |
|
5869 |
|
5870 var getInserterItems = getBlockEditorSelector('getInserterItems'); |
|
5871 /** |
|
5872 * @see hasInserterItems in core/block-editor store. |
|
5873 */ |
|
5874 |
|
6414 var hasInserterItems = getBlockEditorSelector('hasInserterItems'); |
5875 var hasInserterItems = getBlockEditorSelector('hasInserterItems'); |
5876 /** |
|
5877 * @see getBlockListSettings in core/block-editor store. |
|
5878 */ |
|
5879 |
|
6415 var getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); |
5880 var getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); |
6416 |
5881 |
6417 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/reusable-blocks.js |
5882 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/reusable-blocks.js |
6418 |
5883 |
6419 |
5884 |
6420 |
5885 |
5886 |
|
5887 function reusable_blocks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
5888 |
|
5889 function reusable_blocks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reusable_blocks_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reusable_blocks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6421 |
5890 |
6422 /** |
5891 /** |
6423 * External dependencies |
5892 * External dependencies |
6424 */ |
5893 */ |
6425 |
5894 |
6439 * Internal dependencies |
5908 * Internal dependencies |
6440 */ |
5909 */ |
6441 |
5910 |
6442 |
5911 |
6443 |
5912 |
6444 |
|
6445 /** |
5913 /** |
6446 * Module Constants |
5914 * Module Constants |
6447 */ |
5915 */ |
6448 |
5916 |
6449 var REUSABLE_BLOCK_NOTICE_ID = 'REUSABLE_BLOCK_NOTICE_ID'; |
5917 var REUSABLE_BLOCK_NOTICE_ID = 'REUSABLE_BLOCK_NOTICE_ID'; |
6450 /** |
5918 /** |
6451 * Fetch Reusable Blocks Effect Handler. |
5919 * Fetch Reusable blocks Effect Handler. |
6452 * |
5920 * |
6453 * @param {Object} action action object. |
5921 * @param {Object} action action object. |
6454 * @param {Object} store Redux Store. |
5922 * @param {Object} store Redux Store. |
6455 */ |
5923 */ |
6456 |
5924 |
6457 var fetchReusableBlocks = |
5925 var fetchReusableBlocks = /*#__PURE__*/function () { |
6458 /*#__PURE__*/ |
5926 var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee(action, store) { |
6459 function () { |
|
6460 var _ref = Object(asyncToGenerator["a" /* default */])( |
|
6461 /*#__PURE__*/ |
|
6462 regenerator_default.a.mark(function _callee(action, store) { |
|
6463 var id, dispatch, postType, posts, results; |
5927 var id, dispatch, postType, posts, results; |
6464 return regenerator_default.a.wrap(function _callee$(_context) { |
5928 return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context) { |
6465 while (1) { |
5929 while (1) { |
6466 switch (_context.prev = _context.next) { |
5930 switch (_context.prev = _context.next) { |
6467 case 0: |
5931 case 0: |
6468 id = action.id; |
5932 id = action.id; |
6469 dispatch = store.dispatch; // TODO: these are potentially undefined, this fix is in place |
5933 dispatch = store.dispatch; // TODO: these are potentially undefined, this fix is in place |
6511 |
5975 |
6512 case 17: |
5976 case 17: |
6513 posts = _context.sent; |
5977 posts = _context.sent; |
6514 |
5978 |
6515 case 18: |
5979 case 18: |
6516 results = Object(external_lodash_["compact"])(Object(external_lodash_["map"])(posts, function (post) { |
5980 results = Object(external_this_lodash_["compact"])(Object(external_this_lodash_["map"])(posts, function (post) { |
6517 if (post.status !== 'publish' || post.content.protected) { |
5981 if (post.status !== 'publish' || post.content.protected) { |
6518 return null; |
5982 return null; |
6519 } |
5983 } |
6520 |
5984 |
6521 var parsedBlocks = Object(external_this_wp_blocks_["parse"])(post.content.raw); |
5985 return reusable_blocks_objectSpread({}, post, { |
6522 return { |
5986 content: post.content.raw, |
6523 reusableBlock: { |
5987 title: post.title.raw |
6524 id: post.id, |
5988 }); |
6525 title: getPostRawValue(post.title) |
|
6526 }, |
|
6527 parsedBlock: parsedBlocks.length === 1 ? parsedBlocks[0] : Object(external_this_wp_blocks_["createBlock"])('core/template', {}, parsedBlocks) |
|
6528 }; |
|
6529 })); |
5989 })); |
6530 |
5990 |
6531 if (results.length) { |
5991 if (results.length) { |
6532 dispatch(__experimentalReceiveReusableBlocks(results)); |
5992 dispatch(__experimentalReceiveReusableBlocks(results)); |
6533 } |
5993 } |
6551 case 26: |
6011 case 26: |
6552 case "end": |
6012 case "end": |
6553 return _context.stop(); |
6013 return _context.stop(); |
6554 } |
6014 } |
6555 } |
6015 } |
6556 }, _callee, this, [[7, 23]]); |
6016 }, _callee, null, [[7, 23]]); |
6557 })); |
6017 })); |
6558 |
6018 |
6559 return function fetchReusableBlocks(_x, _x2) { |
6019 return function fetchReusableBlocks(_x, _x2) { |
6560 return _ref.apply(this, arguments); |
6020 return _ref.apply(this, arguments); |
6561 }; |
6021 }; |
6562 }(); |
6022 }(); |
6563 /** |
6023 /** |
6564 * Save Reusable Blocks Effect Handler. |
6024 * Save Reusable blocks Effect Handler. |
6565 * |
6025 * |
6566 * @param {Object} action action object. |
6026 * @param {Object} action action object. |
6567 * @param {Object} store Redux Store. |
6027 * @param {Object} store Redux Store. |
6568 */ |
6028 */ |
6569 |
6029 |
6570 var saveReusableBlocks = |
6030 var saveReusableBlocks = /*#__PURE__*/function () { |
6571 /*#__PURE__*/ |
6031 var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee2(action, store) { |
6572 function () { |
6032 var postType, id, dispatch, state, _getReusableBlock, title, content, isTemporary, data, path, method, updatedReusableBlock, message; |
6573 var _ref2 = Object(asyncToGenerator["a" /* default */])( |
6033 |
6574 /*#__PURE__*/ |
6034 return external_this_regeneratorRuntime_default.a.wrap(function _callee2$(_context2) { |
6575 regenerator_default.a.mark(function _callee2(action, store) { |
|
6576 var postType, id, dispatch, state, _getReusableBlock, clientId, title, isTemporary, reusableBlock, content, data, path, method, updatedReusableBlock, message; |
|
6577 |
|
6578 return regenerator_default.a.wrap(function _callee2$(_context2) { |
|
6579 while (1) { |
6035 while (1) { |
6580 switch (_context2.prev = _context2.next) { |
6036 switch (_context2.prev = _context2.next) { |
6581 case 0: |
6037 case 0: |
6582 _context2.next = 2; |
6038 _context2.next = 2; |
6583 return external_this_wp_apiFetch_default()({ |
6039 return external_this_wp_apiFetch_default()({ |
6596 |
6052 |
6597 case 5: |
6053 case 5: |
6598 id = action.id; |
6054 id = action.id; |
6599 dispatch = store.dispatch; |
6055 dispatch = store.dispatch; |
6600 state = store.getState(); |
6056 state = store.getState(); |
6601 _getReusableBlock = __experimentalGetReusableBlock(state, id), clientId = _getReusableBlock.clientId, title = _getReusableBlock.title, isTemporary = _getReusableBlock.isTemporary; |
6057 _getReusableBlock = __experimentalGetReusableBlock(state, id), title = _getReusableBlock.title, content = _getReusableBlock.content, isTemporary = _getReusableBlock.isTemporary; |
6602 reusableBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(clientId); |
|
6603 content = Object(external_this_wp_blocks_["serialize"])(reusableBlock.name === 'core/template' ? reusableBlock.innerBlocks : reusableBlock); |
|
6604 data = isTemporary ? { |
6058 data = isTemporary ? { |
6605 title: title, |
6059 title: title, |
6606 content: content, |
6060 content: content, |
6607 status: 'publish' |
6061 status: 'publish' |
6608 } : { |
6062 } : { |
6611 content: content, |
6065 content: content, |
6612 status: 'publish' |
6066 status: 'publish' |
6613 }; |
6067 }; |
6614 path = isTemporary ? "/wp/v2/".concat(postType.rest_base) : "/wp/v2/".concat(postType.rest_base, "/").concat(id); |
6068 path = isTemporary ? "/wp/v2/".concat(postType.rest_base) : "/wp/v2/".concat(postType.rest_base, "/").concat(id); |
6615 method = isTemporary ? 'POST' : 'PUT'; |
6069 method = isTemporary ? 'POST' : 'PUT'; |
6616 _context2.prev = 14; |
6070 _context2.prev = 12; |
6617 _context2.next = 17; |
6071 _context2.next = 15; |
6618 return external_this_wp_apiFetch_default()({ |
6072 return external_this_wp_apiFetch_default()({ |
6619 path: path, |
6073 path: path, |
6620 data: data, |
6074 data: data, |
6621 method: method |
6075 method: method |
6622 }); |
6076 }); |
6623 |
6077 |
6624 case 17: |
6078 case 15: |
6625 updatedReusableBlock = _context2.sent; |
6079 updatedReusableBlock = _context2.sent; |
6626 dispatch({ |
6080 dispatch({ |
6627 type: 'SAVE_REUSABLE_BLOCK_SUCCESS', |
6081 type: 'SAVE_REUSABLE_BLOCK_SUCCESS', |
6628 updatedId: updatedReusableBlock.id, |
6082 updatedId: updatedReusableBlock.id, |
6629 id: id |
6083 id: id |
6630 }); |
6084 }); |
6631 message = isTemporary ? Object(external_this_wp_i18n_["__"])('Block created.') : Object(external_this_wp_i18n_["__"])('Block updated.'); |
6085 message = isTemporary ? Object(external_this_wp_i18n_["__"])('Block created.') : Object(external_this_wp_i18n_["__"])('Block updated.'); |
6632 Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { |
6086 Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { |
6633 id: REUSABLE_BLOCK_NOTICE_ID |
6087 id: REUSABLE_BLOCK_NOTICE_ID, |
6088 type: 'snackbar' |
|
6634 }); |
6089 }); |
6635 |
6090 |
6636 Object(external_this_wp_data_["dispatch"])('core/block-editor').__unstableSaveReusableBlock(id, updatedReusableBlock.id); |
6091 Object(external_this_wp_data_["dispatch"])('core/block-editor').__unstableSaveReusableBlock(id, updatedReusableBlock.id); |
6637 |
6092 |
6638 _context2.next = 28; |
6093 _context2.next = 26; |
6639 break; |
6094 break; |
6640 |
6095 |
6641 case 24: |
6096 case 22: |
6642 _context2.prev = 24; |
6097 _context2.prev = 22; |
6643 _context2.t0 = _context2["catch"](14); |
6098 _context2.t0 = _context2["catch"](12); |
6644 dispatch({ |
6099 dispatch({ |
6645 type: 'SAVE_REUSABLE_BLOCK_FAILURE', |
6100 type: 'SAVE_REUSABLE_BLOCK_FAILURE', |
6646 id: id |
6101 id: id |
6647 }); |
6102 }); |
6648 Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(_context2.t0.message, { |
6103 Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(_context2.t0.message, { |
6649 id: REUSABLE_BLOCK_NOTICE_ID |
6104 id: REUSABLE_BLOCK_NOTICE_ID |
6650 }); |
6105 }); |
6651 |
6106 |
6652 case 28: |
6107 case 26: |
6653 case "end": |
6108 case "end": |
6654 return _context2.stop(); |
6109 return _context2.stop(); |
6655 } |
6110 } |
6656 } |
6111 } |
6657 }, _callee2, this, [[14, 24]]); |
6112 }, _callee2, null, [[12, 22]]); |
6658 })); |
6113 })); |
6659 |
6114 |
6660 return function saveReusableBlocks(_x3, _x4) { |
6115 return function saveReusableBlocks(_x3, _x4) { |
6661 return _ref2.apply(this, arguments); |
6116 return _ref2.apply(this, arguments); |
6662 }; |
6117 }; |
6663 }(); |
6118 }(); |
6664 /** |
6119 /** |
6665 * Delete Reusable Blocks Effect Handler. |
6120 * Delete Reusable blocks Effect Handler. |
6666 * |
6121 * |
6667 * @param {Object} action action object. |
6122 * @param {Object} action action object. |
6668 * @param {Object} store Redux Store. |
6123 * @param {Object} store Redux Store. |
6669 */ |
6124 */ |
6670 |
6125 |
6671 var deleteReusableBlocks = |
6126 var deleteReusableBlocks = /*#__PURE__*/function () { |
6672 /*#__PURE__*/ |
6127 var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee3(action, store) { |
6673 function () { |
|
6674 var _ref3 = Object(asyncToGenerator["a" /* default */])( |
|
6675 /*#__PURE__*/ |
|
6676 regenerator_default.a.mark(function _callee3(action, store) { |
|
6677 var postType, id, getState, dispatch, reusableBlock, allBlocks, associatedBlocks, associatedBlockClientIds, transactionId, message; |
6128 var postType, id, getState, dispatch, reusableBlock, allBlocks, associatedBlocks, associatedBlockClientIds, transactionId, message; |
6678 return regenerator_default.a.wrap(function _callee3$(_context3) { |
6129 return external_this_regeneratorRuntime_default.a.wrap(function _callee3$(_context3) { |
6679 while (1) { |
6130 while (1) { |
6680 switch (_context3.prev = _context3.next) { |
6131 switch (_context3.prev = _context3.next) { |
6681 case 0: |
6132 case 0: |
6682 _context3.next = 2; |
6133 _context3.next = 2; |
6683 return external_this_wp_apiFetch_default()({ |
6134 return external_this_wp_apiFetch_default()({ |
6714 return Object(external_this_wp_blocks_["isReusableBlock"])(block) && block.attributes.ref === id; |
6165 return Object(external_this_wp_blocks_["isReusableBlock"])(block) && block.attributes.ref === id; |
6715 }); |
6166 }); |
6716 associatedBlockClientIds = associatedBlocks.map(function (block) { |
6167 associatedBlockClientIds = associatedBlocks.map(function (block) { |
6717 return block.clientId; |
6168 return block.clientId; |
6718 }); |
6169 }); |
6719 transactionId = Object(external_lodash_["uniqueId"])(); |
6170 transactionId = Object(external_this_lodash_["uniqueId"])(); |
6720 dispatch({ |
6171 dispatch({ |
6721 type: 'REMOVE_REUSABLE_BLOCK', |
6172 type: 'REMOVE_REUSABLE_BLOCK', |
6722 id: id, |
6173 id: id, |
6723 optimist: { |
6174 optimist: { |
6724 type: redux_optimist["BEGIN"], |
6175 type: redux_optimist["BEGIN"], |
6725 id: transactionId |
6176 id: transactionId |
6726 } |
6177 } |
6727 }); // Remove the parsed block. |
6178 }); // Remove the parsed block. |
6728 |
6179 |
6729 Object(external_this_wp_data_["dispatch"])('core/block-editor').removeBlocks([].concat(Object(toConsumableArray["a" /* default */])(associatedBlockClientIds), [reusableBlock.clientId])); |
6180 if (associatedBlockClientIds.length) { |
6181 Object(external_this_wp_data_["dispatch"])('core/block-editor').removeBlocks(associatedBlockClientIds); |
|
6182 } |
|
6183 |
|
6730 _context3.prev = 16; |
6184 _context3.prev = 16; |
6731 _context3.next = 19; |
6185 _context3.next = 19; |
6732 return external_this_wp_apiFetch_default()({ |
6186 return external_this_wp_apiFetch_default()({ |
6733 path: "/wp/v2/".concat(postType.rest_base, "/").concat(id), |
6187 path: "/wp/v2/".concat(postType.rest_base, "/").concat(id), |
6734 method: 'DELETE' |
6188 method: 'DELETE' |
6743 id: transactionId |
6197 id: transactionId |
6744 } |
6198 } |
6745 }); |
6199 }); |
6746 message = Object(external_this_wp_i18n_["__"])('Block deleted.'); |
6200 message = Object(external_this_wp_i18n_["__"])('Block deleted.'); |
6747 Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { |
6201 Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { |
6748 id: REUSABLE_BLOCK_NOTICE_ID |
6202 id: REUSABLE_BLOCK_NOTICE_ID, |
6203 type: 'snackbar' |
|
6749 }); |
6204 }); |
6750 _context3.next = 28; |
6205 _context3.next = 28; |
6751 break; |
6206 break; |
6752 |
6207 |
6753 case 24: |
6208 case 24: |
6768 case 28: |
6223 case 28: |
6769 case "end": |
6224 case "end": |
6770 return _context3.stop(); |
6225 return _context3.stop(); |
6771 } |
6226 } |
6772 } |
6227 } |
6773 }, _callee3, this, [[16, 24]]); |
6228 }, _callee3, null, [[16, 24]]); |
6774 })); |
6229 })); |
6775 |
6230 |
6776 return function deleteReusableBlocks(_x5, _x6) { |
6231 return function deleteReusableBlocks(_x5, _x6) { |
6777 return _ref3.apply(this, arguments); |
6232 return _ref3.apply(this, arguments); |
6778 }; |
6233 }; |
6779 }(); |
6234 }(); |
6780 /** |
|
6781 * Receive Reusable Blocks Effect Handler. |
|
6782 * |
|
6783 * @param {Object} action action object. |
|
6784 */ |
|
6785 |
|
6786 var reusable_blocks_receiveReusableBlocks = function receiveReusableBlocks(action) { |
|
6787 Object(external_this_wp_data_["dispatch"])('core/block-editor').receiveBlocks(Object(external_lodash_["map"])(action.results, 'parsedBlock')); |
|
6788 }; |
|
6789 /** |
6235 /** |
6790 * Convert a reusable block to a static block effect handler |
6236 * Convert a reusable block to a static block effect handler |
6791 * |
6237 * |
6792 * @param {Object} action action object. |
6238 * @param {Object} action action object. |
6793 * @param {Object} store Redux Store. |
6239 * @param {Object} store Redux Store. |
6795 |
6241 |
6796 var reusable_blocks_convertBlockToStatic = function convertBlockToStatic(action, store) { |
6242 var reusable_blocks_convertBlockToStatic = function convertBlockToStatic(action, store) { |
6797 var state = store.getState(); |
6243 var state = store.getState(); |
6798 var oldBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(action.clientId); |
6244 var oldBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(action.clientId); |
6799 var reusableBlock = __experimentalGetReusableBlock(state, oldBlock.attributes.ref); |
6245 var reusableBlock = __experimentalGetReusableBlock(state, oldBlock.attributes.ref); |
6800 var referencedBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(reusableBlock.clientId); |
6246 var newBlocks = Object(external_this_wp_blocks_["parse"])(reusableBlock.content); |
6801 var newBlocks; |
|
6802 |
|
6803 if (referencedBlock.name === 'core/template') { |
|
6804 newBlocks = referencedBlock.innerBlocks.map(function (innerBlock) { |
|
6805 return Object(external_this_wp_blocks_["cloneBlock"])(innerBlock); |
|
6806 }); |
|
6807 } else { |
|
6808 newBlocks = [Object(external_this_wp_blocks_["cloneBlock"])(referencedBlock)]; |
|
6809 } |
|
6810 |
|
6811 Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(oldBlock.clientId, newBlocks); |
6247 Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(oldBlock.clientId, newBlocks); |
6812 }; |
6248 }; |
6813 /** |
6249 /** |
6814 * Convert a static block to a reusable block effect handler |
6250 * Convert a static block to a reusable block effect handler |
6815 * |
6251 * |
6817 * @param {Object} store Redux Store. |
6253 * @param {Object} store Redux Store. |
6818 */ |
6254 */ |
6819 |
6255 |
6820 var reusable_blocks_convertBlockToReusable = function convertBlockToReusable(action, store) { |
6256 var reusable_blocks_convertBlockToReusable = function convertBlockToReusable(action, store) { |
6821 var dispatch = store.dispatch; |
6257 var dispatch = store.dispatch; |
6822 var parsedBlock; |
|
6823 |
|
6824 if (action.clientIds.length === 1) { |
|
6825 parsedBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(action.clientIds[0]); |
|
6826 } else { |
|
6827 parsedBlock = Object(external_this_wp_blocks_["createBlock"])('core/template', {}, Object(external_this_wp_data_["select"])('core/block-editor').getBlocksByClientId(action.clientIds)); // This shouldn't be necessary but at the moment |
|
6828 // we expect the content of the shared blocks to live in the blocks state. |
|
6829 |
|
6830 Object(external_this_wp_data_["dispatch"])('core/block-editor').receiveBlocks([parsedBlock]); |
|
6831 } |
|
6832 |
|
6833 var reusableBlock = { |
6258 var reusableBlock = { |
6834 id: Object(external_lodash_["uniqueId"])('reusable'), |
6259 id: Object(external_this_lodash_["uniqueId"])('reusable'), |
6835 clientId: parsedBlock.clientId, |
6260 title: Object(external_this_wp_i18n_["__"])('Untitled Reusable Block'), |
6836 title: Object(external_this_wp_i18n_["__"])('Untitled Reusable Block') |
6261 content: Object(external_this_wp_blocks_["serialize"])(Object(external_this_wp_data_["select"])('core/block-editor').getBlocksByClientId(action.clientIds)) |
6837 }; |
6262 }; |
6838 dispatch(__experimentalReceiveReusableBlocks([{ |
6263 dispatch(__experimentalReceiveReusableBlocks([reusableBlock])); |
6839 reusableBlock: reusableBlock, |
|
6840 parsedBlock: parsedBlock |
|
6841 }])); |
|
6842 dispatch(__experimentalSaveReusableBlock(reusableBlock.id)); |
6264 dispatch(__experimentalSaveReusableBlock(reusableBlock.id)); |
6843 Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(action.clientIds, Object(external_this_wp_blocks_["createBlock"])('core/block', { |
6265 Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(action.clientIds, Object(external_this_wp_blocks_["createBlock"])('core/block', { |
6844 ref: reusableBlock.id |
6266 ref: reusableBlock.id |
6845 })); // Re-add the original block to the store, since replaceBlock() will have removed it |
6267 })); |
6846 |
|
6847 Object(external_this_wp_data_["dispatch"])('core/block-editor').receiveBlocks([parsedBlock]); |
|
6848 }; |
6268 }; |
6849 |
6269 |
6850 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects.js |
6270 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects.js |
6851 /** |
6271 /** |
6852 * External dependencies |
|
6853 */ |
|
6854 |
|
6855 /** |
|
6856 * WordPress dependencies |
|
6857 */ |
|
6858 |
|
6859 |
|
6860 /** |
|
6861 * Internal dependencies |
6272 * Internal dependencies |
6862 */ |
6273 */ |
6863 |
6274 |
6864 |
|
6865 |
|
6866 /* harmony default export */ var effects = ({ |
6275 /* harmony default export */ var effects = ({ |
6867 SETUP_EDITOR: function SETUP_EDITOR(action) { |
|
6868 var post = action.post, |
|
6869 edits = action.edits, |
|
6870 template = action.template; // In order to ensure maximum of a single parse during setup, edits are |
|
6871 // included as part of editor setup action. Assume edited content as |
|
6872 // canonical if provided, falling back to post. |
|
6873 |
|
6874 var content; |
|
6875 |
|
6876 if (Object(external_lodash_["has"])(edits, ['content'])) { |
|
6877 content = edits.content; |
|
6878 } else { |
|
6879 content = post.content.raw; |
|
6880 } |
|
6881 |
|
6882 var blocks = Object(external_this_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists. |
|
6883 |
|
6884 var isNewPost = post.status === 'auto-draft'; |
|
6885 |
|
6886 if (isNewPost && template) { |
|
6887 blocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); |
|
6888 } |
|
6889 |
|
6890 return [actions_resetEditorBlocks(blocks), setupEditorState(post)]; |
|
6891 }, |
|
6892 FETCH_REUSABLE_BLOCKS: function FETCH_REUSABLE_BLOCKS(action, store) { |
6276 FETCH_REUSABLE_BLOCKS: function FETCH_REUSABLE_BLOCKS(action, store) { |
6893 fetchReusableBlocks(action, store); |
6277 fetchReusableBlocks(action, store); |
6894 }, |
6278 }, |
6895 SAVE_REUSABLE_BLOCK: function SAVE_REUSABLE_BLOCK(action, store) { |
6279 SAVE_REUSABLE_BLOCK: function SAVE_REUSABLE_BLOCK(action, store) { |
6896 saveReusableBlocks(action, store); |
6280 saveReusableBlocks(action, store); |
6897 }, |
6281 }, |
6898 DELETE_REUSABLE_BLOCK: function DELETE_REUSABLE_BLOCK(action, store) { |
6282 DELETE_REUSABLE_BLOCK: function DELETE_REUSABLE_BLOCK(action, store) { |
6899 deleteReusableBlocks(action, store); |
6283 deleteReusableBlocks(action, store); |
6900 }, |
6284 }, |
6901 RECEIVE_REUSABLE_BLOCKS: reusable_blocks_receiveReusableBlocks, |
|
6902 CONVERT_BLOCK_TO_STATIC: reusable_blocks_convertBlockToStatic, |
6285 CONVERT_BLOCK_TO_STATIC: reusable_blocks_convertBlockToStatic, |
6903 CONVERT_BLOCK_TO_REUSABLE: reusable_blocks_convertBlockToReusable |
6286 CONVERT_BLOCK_TO_REUSABLE: reusable_blocks_convertBlockToReusable |
6904 }); |
6287 }); |
6905 |
6288 |
6906 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/middlewares.js |
6289 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/middlewares.js |
6907 |
|
6908 |
|
6909 /** |
6290 /** |
6910 * External dependencies |
6291 * External dependencies |
6911 */ |
6292 */ |
6912 |
6293 |
6913 |
|
6914 |
|
6915 /** |
6294 /** |
6916 * Internal dependencies |
6295 * Internal dependencies |
6917 */ |
6296 */ |
6918 |
6297 |
6919 |
6298 |
6924 * |
6303 * |
6925 * @return {Object} Update Store Object. |
6304 * @return {Object} Update Store Object. |
6926 */ |
6305 */ |
6927 |
6306 |
6928 function applyMiddlewares(store) { |
6307 function applyMiddlewares(store) { |
6929 var middlewares = [refx_default()(effects), lib_default.a]; |
|
6930 |
|
6931 var enhancedDispatch = function enhancedDispatch() { |
6308 var enhancedDispatch = function enhancedDispatch() { |
6932 throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); |
6309 throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); |
6933 }; |
6310 }; |
6934 |
6311 |
6935 var chain = []; |
|
6936 var middlewareAPI = { |
6312 var middlewareAPI = { |
6937 getState: store.getState, |
6313 getState: store.getState, |
6938 dispatch: function dispatch() { |
6314 dispatch: function dispatch() { |
6939 return enhancedDispatch.apply(void 0, arguments); |
6315 return enhancedDispatch.apply(void 0, arguments); |
6940 } |
6316 } |
6941 }; |
6317 }; |
6942 chain = middlewares.map(function (middleware) { |
6318 enhancedDispatch = refx_default()(effects)(middlewareAPI)(store.dispatch); |
6943 return middleware(middlewareAPI); |
|
6944 }); |
|
6945 enhancedDispatch = external_lodash_["flowRight"].apply(void 0, Object(toConsumableArray["a" /* default */])(chain))(store.dispatch); |
|
6946 store.dispatch = enhancedDispatch; |
6319 store.dispatch = enhancedDispatch; |
6947 return store; |
6320 return store; |
6948 } |
6321 } |
6949 |
6322 |
6950 /* harmony default export */ var store_middlewares = (applyMiddlewares); |
6323 /* harmony default export */ var middlewares = (applyMiddlewares); |
6324 |
|
6325 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js |
|
6326 /** |
|
6327 * WordPress dependencies |
|
6328 */ |
|
6329 |
|
6330 /** |
|
6331 * Returns a control descriptor signalling to subscribe to the registry and |
|
6332 * resolve the control promise only when the next state change occurs. |
|
6333 * |
|
6334 * @return {Object} Control descriptor. |
|
6335 */ |
|
6336 |
|
6337 function awaitNextStateChange() { |
|
6338 return { |
|
6339 type: 'AWAIT_NEXT_STATE_CHANGE' |
|
6340 }; |
|
6341 } |
|
6342 /** |
|
6343 * Returns a control descriptor signalling to resolve with the current data |
|
6344 * registry. |
|
6345 * |
|
6346 * @return {Object} Control descriptor. |
|
6347 */ |
|
6348 |
|
6349 function getRegistry() { |
|
6350 return { |
|
6351 type: 'GET_REGISTRY' |
|
6352 }; |
|
6353 } |
|
6354 /** |
|
6355 * Function returning a sessionStorage key to set or retrieve a given post's |
|
6356 * automatic session backup. |
|
6357 * |
|
6358 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's |
|
6359 * `loggedout` handler can clear sessionStorage of any user-private content. |
|
6360 * |
|
6361 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 |
|
6362 * |
|
6363 * @param {string} postId Post ID. |
|
6364 * @return {string} sessionStorage key |
|
6365 */ |
|
6366 |
|
6367 function postKey(postId) { |
|
6368 return "wp-autosave-block-editor-post-".concat(postId); |
|
6369 } |
|
6370 |
|
6371 function localAutosaveGet(postId) { |
|
6372 return window.sessionStorage.getItem(postKey(postId)); |
|
6373 } |
|
6374 function localAutosaveSet(postId, title, content, excerpt) { |
|
6375 window.sessionStorage.setItem(postKey(postId), JSON.stringify({ |
|
6376 post_title: title, |
|
6377 content: content, |
|
6378 excerpt: excerpt |
|
6379 })); |
|
6380 } |
|
6381 function localAutosaveClear(postId) { |
|
6382 window.sessionStorage.removeItem(postKey(postId)); |
|
6383 } |
|
6384 var controls = { |
|
6385 AWAIT_NEXT_STATE_CHANGE: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { |
|
6386 return function () { |
|
6387 return new Promise(function (resolve) { |
|
6388 var unsubscribe = registry.subscribe(function () { |
|
6389 unsubscribe(); |
|
6390 resolve(); |
|
6391 }); |
|
6392 }); |
|
6393 }; |
|
6394 }), |
|
6395 GET_REGISTRY: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { |
|
6396 return function () { |
|
6397 return registry; |
|
6398 }; |
|
6399 }), |
|
6400 LOCAL_AUTOSAVE_SET: function LOCAL_AUTOSAVE_SET(_ref) { |
|
6401 var postId = _ref.postId, |
|
6402 title = _ref.title, |
|
6403 content = _ref.content, |
|
6404 excerpt = _ref.excerpt; |
|
6405 localAutosaveSet(postId, title, content, excerpt); |
|
6406 } |
|
6407 }; |
|
6408 /* harmony default export */ var store_controls = (controls); |
|
6951 |
6409 |
6952 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js |
6410 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js |
6411 |
|
6412 |
|
6413 function store_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
6414 |
|
6415 function store_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { store_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { store_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6416 |
|
6953 /** |
6417 /** |
6954 * WordPress dependencies |
6418 * WordPress dependencies |
6955 */ |
6419 */ |
6956 |
6420 |
6421 |
|
6957 /** |
6422 /** |
6958 * Internal dependencies |
6423 * Internal dependencies |
6959 */ |
6424 */ |
6960 |
6425 |
6961 |
6426 |
6962 |
6427 |
6963 |
6428 |
6964 |
6429 |
6965 |
6430 |
6966 |
6431 |
6967 var store_store = Object(external_this_wp_data_["registerStore"])(STORE_KEY, { |
6432 /** |
6968 reducer: store_reducer, |
6433 * Post editor data store configuration. |
6434 * |
|
6435 * @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore |
|
6436 * |
|
6437 * @type {Object} |
|
6438 */ |
|
6439 |
|
6440 var storeConfig = { |
|
6441 reducer: reducer, |
|
6969 selectors: selectors_namespaceObject, |
6442 selectors: selectors_namespaceObject, |
6970 actions: actions_namespaceObject, |
6443 actions: actions_namespaceObject, |
6971 controls: controls, |
6444 controls: store_objectSpread({}, external_this_wp_dataControls_["controls"], {}, store_controls) |
6445 }; |
|
6446 var store_store = Object(external_this_wp_data_["registerStore"])(STORE_KEY, store_objectSpread({}, storeConfig, { |
|
6972 persist: ['preferences'] |
6447 persist: ['preferences'] |
6973 }); |
6448 })); |
6974 store_middlewares(store_store); |
6449 middlewares(store_store); |
6975 /* harmony default export */ var build_module_store = (store_store); |
6450 /* harmony default export */ var build_module_store = (store_store); |
6976 |
6451 |
6977 // EXTERNAL MODULE: external {"this":["wp","hooks"]} |
6452 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
6978 var external_this_wp_hooks_ = __webpack_require__(26); |
6453 var esm_extends = __webpack_require__(8); |
6454 |
|
6455 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
6456 var objectWithoutProperties = __webpack_require__(15); |
|
6979 |
6457 |
6980 // EXTERNAL MODULE: external {"this":["wp","element"]} |
6458 // EXTERNAL MODULE: external {"this":["wp","element"]} |
6981 var external_this_wp_element_ = __webpack_require__(0); |
6459 var external_this_wp_element_ = __webpack_require__(0); |
6982 |
6460 |
6983 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/block.js |
6461 // EXTERNAL MODULE: external {"this":["wp","compose"]} |
6984 |
6462 var external_this_wp_compose_ = __webpack_require__(9); |
6985 |
6463 |
6464 // EXTERNAL MODULE: external {"this":["wp","hooks"]} |
|
6465 var external_this_wp_hooks_ = __webpack_require__(32); |
|
6466 |
|
6467 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js |
|
6468 |
|
6469 |
|
6470 |
|
6471 |
|
6472 |
|
6473 |
|
6474 function custom_sources_backwards_compatibility_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
6475 |
|
6476 function custom_sources_backwards_compatibility_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { custom_sources_backwards_compatibility_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { custom_sources_backwards_compatibility_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6477 |
|
6478 /** |
|
6479 * External dependencies |
|
6480 */ |
|
6986 |
6481 |
6987 /** |
6482 /** |
6988 * WordPress dependencies |
6483 * WordPress dependencies |
6989 */ |
6484 */ |
6990 |
6485 |
6991 |
6486 |
6992 |
6487 |
6993 /** |
6488 |
6994 * Returns the client ID of the parent where a newly inserted block would be |
6489 |
6995 * placed. |
6490 |
6996 * |
6491 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ |
6997 * @return {string} Client ID of the parent where a newly inserted block would |
6492 |
6998 * be placed. |
6493 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ |
6999 */ |
6494 |
7000 |
6495 /** |
7001 function defaultGetBlockInsertionParentClientId() { |
6496 * Object whose keys are the names of block attributes, where each value |
7002 return Object(external_this_wp_data_["select"])('core/block-editor').getBlockInsertionPoint().rootClientId; |
6497 * represents the meta key to which the block attribute is intended to save. |
7003 } |
6498 * |
7004 /** |
6499 * @see https://developer.wordpress.org/reference/functions/register_meta/ |
7005 * Returns the inserter items for the specified parent block. |
6500 * |
7006 * |
6501 * @typedef {Object<string,string>} WPMetaAttributeMapping |
7007 * @param {string} rootClientId Client ID of the block for which to retrieve |
6502 */ |
7008 * inserter items. |
6503 |
7009 * |
6504 /** |
7010 * @return {Array<Editor.InserterItem>} The inserter items for the specified |
6505 * Given a mapping of attribute names (meta source attributes) to their |
7011 * parent. |
6506 * associated meta key, returns a higher order component that overrides its |
7012 */ |
6507 * `attributes` and `setAttributes` props to sync any changes with the edited |
7013 |
6508 * post's meta keys. |
7014 |
6509 * |
7015 function defaultGetInserterItems(rootClientId) { |
6510 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. |
7016 return Object(external_this_wp_data_["select"])('core/block-editor').getInserterItems(rootClientId); |
6511 * |
7017 } |
6512 * @return {WPHigherOrderComponent} Higher-order component. |
7018 /** |
6513 */ |
7019 * Returns the name of the currently selected block. |
6514 |
7020 * |
6515 var custom_sources_backwards_compatibility_createWithMetaAttributeSource = function createWithMetaAttributeSource(metaAttributes) { |
7021 * @return {string?} The name of the currently selected block or `null` if no |
6516 return Object(external_this_wp_compose_["createHigherOrderComponent"])(function (BlockEdit) { |
7022 * block is selected. |
6517 return function (_ref) { |
7023 */ |
6518 var attributes = _ref.attributes, |
7024 |
6519 _setAttributes = _ref.setAttributes, |
7025 |
6520 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["attributes", "setAttributes"]); |
7026 function defaultGetSelectedBlockName() { |
6521 |
7027 var _select = Object(external_this_wp_data_["select"])('core/block-editor'), |
6522 var postType = Object(external_this_wp_data_["useSelect"])(function (select) { |
7028 getSelectedBlockClientId = _select.getSelectedBlockClientId, |
6523 return select('core/editor').getCurrentPostType(); |
7029 getBlockName = _select.getBlockName; |
6524 }, []); |
7030 |
6525 |
7031 var selectedBlockClientId = getSelectedBlockClientId(); |
6526 var _useEntityProp = Object(external_this_wp_coreData_["useEntityProp"])('postType', postType, 'meta'), |
7032 return selectedBlockClientId ? getBlockName(selectedBlockClientId) : null; |
6527 _useEntityProp2 = Object(slicedToArray["a" /* default */])(_useEntityProp, 2), |
7033 } |
6528 meta = _useEntityProp2[0], |
7034 /** |
6529 setMeta = _useEntityProp2[1]; |
7035 * Creates a blocks repeater for replacing the current block with a selected block type. |
6530 |
7036 * |
6531 var mergedAttributes = Object(external_this_wp_element_["useMemo"])(function () { |
7037 * @return {Completer} A blocks completer. |
6532 return custom_sources_backwards_compatibility_objectSpread({}, attributes, {}, Object(external_this_lodash_["mapValues"])(metaAttributes, function (metaKey) { |
7038 */ |
6533 return meta[metaKey]; |
7039 |
6534 })); |
7040 |
6535 }, [attributes, meta]); |
7041 function createBlockCompleter() { |
6536 return Object(external_this_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ |
7042 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, |
6537 attributes: mergedAttributes, |
7043 _ref$getBlockInsertio = _ref.getBlockInsertionParentClientId, |
6538 setAttributes: function setAttributes(nextAttributes) { |
7044 getBlockInsertionParentClientId = _ref$getBlockInsertio === void 0 ? defaultGetBlockInsertionParentClientId : _ref$getBlockInsertio, |
6539 var nextMeta = Object(external_this_lodash_["mapKeys"])( // Filter to intersection of keys between the updated |
7045 _ref$getInserterItems = _ref.getInserterItems, |
6540 // attributes and those with an associated meta key. |
7046 getInserterItems = _ref$getInserterItems === void 0 ? defaultGetInserterItems : _ref$getInserterItems, |
6541 Object(external_this_lodash_["pickBy"])(nextAttributes, function (value, key) { |
7047 _ref$getSelectedBlock = _ref.getSelectedBlockName, |
6542 return metaAttributes[key]; |
7048 getSelectedBlockName = _ref$getSelectedBlock === void 0 ? defaultGetSelectedBlockName : _ref$getSelectedBlock; |
6543 }), // Rename the keys to the expected meta key name. |
7049 |
6544 function (value, attributeKey) { |
7050 return { |
6545 return metaAttributes[attributeKey]; |
7051 name: 'blocks', |
6546 }); |
7052 className: 'editor-autocompleters__block', |
6547 |
7053 triggerPrefix: '/', |
6548 if (!Object(external_this_lodash_["isEmpty"])(nextMeta)) { |
7054 options: function options() { |
6549 setMeta(nextMeta); |
7055 var selectedBlockName = getSelectedBlockName(); |
6550 } |
7056 return getInserterItems(getBlockInsertionParentClientId()).filter( // Avoid offering to replace the current block with a block of the same type. |
6551 |
7057 function (inserterItem) { |
6552 _setAttributes(nextAttributes); |
7058 return selectedBlockName !== inserterItem.name; |
6553 } |
7059 }); |
6554 }, props)); |
7060 }, |
6555 }; |
7061 getOptionKeywords: function getOptionKeywords(inserterItem) { |
6556 }, 'withMetaAttributeSource'); |
7062 var title = inserterItem.title, |
6557 }; |
7063 _inserterItem$keyword = inserterItem.keywords, |
6558 /** |
7064 keywords = _inserterItem$keyword === void 0 ? [] : _inserterItem$keyword, |
6559 * Filters a registered block's settings to enhance a block's `edit` component |
7065 category = inserterItem.category; |
6560 * to upgrade meta-sourced attributes to use the post's meta entity property. |
7066 return [category].concat(Object(toConsumableArray["a" /* default */])(keywords), [title]); |
6561 * |
7067 }, |
6562 * @param {WPBlockSettings} settings Registered block settings. |
7068 getOptionLabel: function getOptionLabel(inserterItem) { |
6563 * |
7069 var icon = inserterItem.icon, |
6564 * @return {WPBlockSettings} Filtered block settings. |
7070 title = inserterItem.title; |
6565 */ |
7071 return [Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { |
6566 |
7072 key: "icon", |
6567 |
7073 icon: icon, |
6568 function shimAttributeSource(settings) { |
7074 showColors: true |
6569 /** @type {WPMetaAttributeMapping} */ |
7075 }), title]; |
6570 var metaAttributes = Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pickBy"])(settings.attributes, { |
7076 }, |
6571 source: 'meta' |
7077 allowContext: function allowContext(before, after) { |
6572 }), 'meta'); |
7078 return !(/\S/.test(before) || /\S/.test(after)); |
6573 |
7079 }, |
6574 if (!Object(external_this_lodash_["isEmpty"])(metaAttributes)) { |
7080 getOptionCompletion: function getOptionCompletion(inserterItem) { |
6575 settings.edit = custom_sources_backwards_compatibility_createWithMetaAttributeSource(metaAttributes)(settings.edit); |
7081 var name = inserterItem.name, |
6576 } |
7082 initialAttributes = inserterItem.initialAttributes; |
6577 |
7083 return { |
6578 return settings; |
7084 action: 'replace', |
6579 } |
7085 value: Object(external_this_wp_blocks_["createBlock"])(name, initialAttributes) |
6580 |
7086 }; |
6581 Object(external_this_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 |
7087 }, |
6582 // added. There may already be blocks registered by this point, and those must |
7088 isOptionDisabled: function isOptionDisabled(inserterItem) { |
6583 // be updated to apply the shim. |
7089 return inserterItem.isDisabled; |
6584 // |
7090 } |
6585 // The following implementation achieves this, albeit with a couple caveats: |
7091 }; |
6586 // - Only blocks registered on the global store will be modified. |
7092 } |
6587 // - The block settings are directly mutated, since there is currently no |
7093 /** |
6588 // mechanism to update an existing block registration. This is the reason for |
7094 * Creates a blocks repeater for replacing the current block with a selected block type. |
6589 // `getBlockType` separate from `getBlockTypes`, since the latter returns a |
7095 * |
6590 // _copy_ of the block registration (i.e. the mutation would not affect the |
7096 * @return {Completer} A blocks completer. |
6591 // actual registered block settings). |
7097 */ |
6592 // |
7098 |
6593 // `getBlockTypes` or `getBlockType` implementation could change in the future |
7099 /* harmony default export */ var autocompleters_block = (createBlockCompleter()); |
6594 // in regards to creating settings clones, but the corresponding end-to-end |
6595 // tests for meta blocks should cover against any potential regressions. |
|
6596 // |
|
6597 // In the future, we could support updating block settings, at which point this |
|
6598 // implementation could use that mechanism instead. |
|
6599 |
|
6600 Object(external_this_wp_data_["select"])('core/blocks').getBlockTypes().map(function (_ref2) { |
|
6601 var name = _ref2.name; |
|
6602 return Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name); |
|
6603 }).forEach(shimAttributeSource); |
|
7100 |
6604 |
7101 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js |
6605 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js |
7102 |
6606 |
7103 |
6607 |
7104 /** |
6608 /** |
7105 * WordPress dependencies |
6609 * WordPress dependencies |
7106 */ |
6610 */ |
7107 |
6611 |
7108 /** |
6612 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ |
7109 * A user mentions completer. |
6613 |
7110 * |
6614 /** |
7111 * @type {Completer} |
6615 * A user mentions completer. |
7112 */ |
6616 * |
6617 * @type {WPCompleter} |
|
6618 */ |
|
7113 |
6619 |
7114 /* harmony default export */ var autocompleters_user = ({ |
6620 /* harmony default export */ var autocompleters_user = ({ |
7115 name: 'users', |
6621 name: 'users', |
7116 className: 'editor-autocompleters__user', |
6622 className: 'editor-autocompleters__user', |
7117 triggerPrefix: '@', |
6623 triggerPrefix: '@', |
7129 isDebounced: true, |
6635 isDebounced: true, |
7130 getOptionKeywords: function getOptionKeywords(user) { |
6636 getOptionKeywords: function getOptionKeywords(user) { |
7131 return [user.slug, user.name]; |
6637 return [user.slug, user.name]; |
7132 }, |
6638 }, |
7133 getOptionLabel: function getOptionLabel(user) { |
6639 getOptionLabel: function getOptionLabel(user) { |
7134 return [Object(external_this_wp_element_["createElement"])("img", { |
6640 var avatar = user.avatar_urls && user.avatar_urls[24] ? Object(external_this_wp_element_["createElement"])("img", { |
7135 key: "avatar", |
6641 key: "avatar", |
7136 className: "editor-autocompleters__user-avatar", |
6642 className: "editor-autocompleters__user-avatar", |
7137 alt: "", |
6643 alt: "", |
7138 src: user.avatar_urls[24] |
6644 src: user.avatar_urls[24] |
7139 }), Object(external_this_wp_element_["createElement"])("span", { |
6645 }) : Object(external_this_wp_element_["createElement"])("span", { |
6646 className: "editor-autocompleters__no-avatar" |
|
6647 }); |
|
6648 return [avatar, Object(external_this_wp_element_["createElement"])("span", { |
|
7140 key: "name", |
6649 key: "name", |
7141 className: "editor-autocompleters__user-name" |
6650 className: "editor-autocompleters__user-name" |
7142 }, user.name), Object(external_this_wp_element_["createElement"])("span", { |
6651 }, user.name), Object(external_this_wp_element_["createElement"])("span", { |
7143 key: "slug", |
6652 key: "slug", |
7144 className: "editor-autocompleters__user-slug" |
6653 className: "editor-autocompleters__user-slug" |
7147 getOptionCompletion: function getOptionCompletion(user) { |
6656 getOptionCompletion: function getOptionCompletion(user) { |
7148 return "@".concat(user.slug); |
6657 return "@".concat(user.slug); |
7149 } |
6658 } |
7150 }); |
6659 }); |
7151 |
6660 |
6661 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js |
|
6662 /** |
|
6663 * External dependencies |
|
6664 */ |
|
6665 |
|
6666 /** |
|
6667 * WordPress dependencies |
|
6668 */ |
|
6669 |
|
6670 |
|
6671 /** |
|
6672 * Internal dependencies |
|
6673 */ |
|
6674 |
|
6675 |
|
6676 |
|
6677 function setDefaultCompleters() { |
|
6678 var completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
6679 // Provide copies so filters may directly modify them. |
|
6680 completers.push(Object(external_this_lodash_["clone"])(autocompleters_user)); |
|
6681 return completers; |
|
6682 } |
|
6683 |
|
6684 Object(external_this_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); |
|
6685 |
|
6686 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js |
|
6687 /** |
|
6688 * Internal dependencies |
|
6689 */ |
|
6690 |
|
6691 |
|
6692 |
|
7152 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js |
6693 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js |
7153 |
6694 |
7154 |
6695 |
7155 |
6696 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
7156 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
6697 var classCallCheck = __webpack_require__(20); |
7157 var esm_extends = __webpack_require__(19); |
6698 |
7158 |
6699 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js |
7159 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules |
6700 var createClass = __webpack_require__(19); |
7160 var objectWithoutProperties = __webpack_require__(21); |
6701 |
7161 |
6702 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
7162 // EXTERNAL MODULE: external {"this":["wp","components"]} |
6703 var possibleConstructorReturn = __webpack_require__(23); |
7163 var external_this_wp_components_ = __webpack_require__(4); |
6704 |
7164 |
6705 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
7165 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/server-side-render/index.js |
6706 var getPrototypeOf = __webpack_require__(16); |
7166 |
6707 |
7167 |
6708 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules |
7168 |
6709 var inherits = __webpack_require__(22); |
7169 |
6710 |
6711 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js |
|
6712 |
|
6713 |
|
6714 |
|
6715 |
|
6716 |
|
6717 |
|
6718 function _createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
6719 |
|
6720 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
7170 |
6721 |
7171 /** |
6722 /** |
7172 * WordPress dependencies |
6723 * WordPress dependencies |
7173 */ |
6724 */ |
7174 |
6725 |
7175 |
6726 |
7176 /* harmony default export */ var server_side_render = (function (_ref) { |
6727 |
7177 var _ref$urlQueryArgs = _ref.urlQueryArgs, |
6728 var autosave_monitor_AutosaveMonitor = /*#__PURE__*/function (_Component) { |
7178 urlQueryArgs = _ref$urlQueryArgs === void 0 ? {} : _ref$urlQueryArgs, |
|
7179 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["urlQueryArgs"]); |
|
7180 |
|
7181 var _select = Object(external_this_wp_data_["select"])('core/editor'), |
|
7182 getCurrentPostId = _select.getCurrentPostId; |
|
7183 |
|
7184 urlQueryArgs = Object(objectSpread["a" /* default */])({ |
|
7185 post_id: getCurrentPostId() |
|
7186 }, urlQueryArgs); |
|
7187 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ServerSideRender"], Object(esm_extends["a" /* default */])({ |
|
7188 urlQueryArgs: urlQueryArgs |
|
7189 }, props)); |
|
7190 }); |
|
7191 |
|
7192 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
|
7193 var classCallCheck = __webpack_require__(10); |
|
7194 |
|
7195 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js |
|
7196 var createClass = __webpack_require__(9); |
|
7197 |
|
7198 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
|
7199 var possibleConstructorReturn = __webpack_require__(11); |
|
7200 |
|
7201 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
|
7202 var getPrototypeOf = __webpack_require__(12); |
|
7203 |
|
7204 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules |
|
7205 var inherits = __webpack_require__(13); |
|
7206 |
|
7207 // EXTERNAL MODULE: external {"this":["wp","compose"]} |
|
7208 var external_this_wp_compose_ = __webpack_require__(6); |
|
7209 |
|
7210 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js |
|
7211 |
|
7212 |
|
7213 |
|
7214 |
|
7215 |
|
7216 |
|
7217 /** |
|
7218 * WordPress dependencies |
|
7219 */ |
|
7220 |
|
7221 |
|
7222 |
|
7223 var autosave_monitor_AutosaveMonitor = |
|
7224 /*#__PURE__*/ |
|
7225 function (_Component) { |
|
7226 Object(inherits["a" /* default */])(AutosaveMonitor, _Component); |
6729 Object(inherits["a" /* default */])(AutosaveMonitor, _Component); |
6730 |
|
6731 var _super = _createSuper(AutosaveMonitor); |
|
7227 |
6732 |
7228 function AutosaveMonitor() { |
6733 function AutosaveMonitor() { |
7229 Object(classCallCheck["a" /* default */])(this, AutosaveMonitor); |
6734 Object(classCallCheck["a" /* default */])(this, AutosaveMonitor); |
7230 |
6735 |
7231 return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(AutosaveMonitor).apply(this, arguments)); |
6736 return _super.apply(this, arguments); |
7232 } |
6737 } |
7233 |
6738 |
7234 Object(createClass["a" /* default */])(AutosaveMonitor, [{ |
6739 Object(createClass["a" /* default */])(AutosaveMonitor, [{ |
7235 key: "componentDidUpdate", |
6740 key: "componentDidUpdate", |
7236 value: function componentDidUpdate(prevProps) { |
6741 value: function componentDidUpdate(prevProps) { |
7265 }, { |
6770 }, { |
7266 key: "toggleTimer", |
6771 key: "toggleTimer", |
7267 value: function toggleTimer(isPendingSave) { |
6772 value: function toggleTimer(isPendingSave) { |
7268 var _this = this; |
6773 var _this = this; |
7269 |
6774 |
7270 clearTimeout(this.pendingSave); |
6775 var _this$props2 = this.props, |
7271 var autosaveInterval = this.props.autosaveInterval; |
6776 interval = _this$props2.interval, |
7272 |
6777 _this$props2$shouldTh = _this$props2.shouldThrottle, |
7273 if (isPendingSave) { |
6778 shouldThrottle = _this$props2$shouldTh === void 0 ? false : _this$props2$shouldTh; // By default, AutosaveMonitor will wait for a pause in editing before |
6779 // autosaving. In other words, its action is "debounced". |
|
6780 // |
|
6781 // The `shouldThrottle` props allows overriding this behaviour, thus |
|
6782 // making the autosave action "throttled". |
|
6783 |
|
6784 if (!shouldThrottle && this.pendingSave) { |
|
6785 clearTimeout(this.pendingSave); |
|
6786 delete this.pendingSave; |
|
6787 } |
|
6788 |
|
6789 if (isPendingSave && !(shouldThrottle && this.pendingSave)) { |
|
7274 this.pendingSave = setTimeout(function () { |
6790 this.pendingSave = setTimeout(function () { |
7275 return _this.props.autosave(); |
6791 _this.props.autosave(); |
7276 }, autosaveInterval * 1000); |
6792 |
6793 delete _this.pendingSave; |
|
6794 }, interval * 1000); |
|
7277 } |
6795 } |
7278 } |
6796 } |
7279 }, { |
6797 }, { |
7280 key: "render", |
6798 key: "render", |
7281 value: function render() { |
6799 value: function render() { |
7283 } |
6801 } |
7284 }]); |
6802 }]); |
7285 |
6803 |
7286 return AutosaveMonitor; |
6804 return AutosaveMonitor; |
7287 }(external_this_wp_element_["Component"]); |
6805 }(external_this_wp_element_["Component"]); |
7288 /* harmony default export */ var autosave_monitor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
6806 /* harmony default export */ var autosave_monitor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { |
7289 var _select = select('core/editor'), |
6807 var _select = select('core'), |
7290 isEditedPostDirty = _select.isEditedPostDirty, |
6808 getReferenceByDistinctEdits = _select.getReferenceByDistinctEdits; |
7291 isEditedPostAutosaveable = _select.isEditedPostAutosaveable, |
6809 |
7292 getReferenceByDistinctEdits = _select.getReferenceByDistinctEdits, |
6810 var _select2 = select('core/editor'), |
7293 isAutosavingPost = _select.isAutosavingPost; |
6811 isEditedPostDirty = _select2.isEditedPostDirty, |
7294 |
6812 isEditedPostAutosaveable = _select2.isEditedPostAutosaveable, |
7295 var _select$getEditorSett = select('core/editor').getEditorSettings(), |
6813 isAutosavingPost = _select2.isAutosavingPost, |
7296 autosaveInterval = _select$getEditorSett.autosaveInterval; |
6814 getEditorSettings = _select2.getEditorSettings; |
7297 |
6815 |
6816 var _ownProps$interval = ownProps.interval, |
|
6817 interval = _ownProps$interval === void 0 ? getEditorSettings().autosaveInterval : _ownProps$interval; |
|
7298 return { |
6818 return { |
7299 isDirty: isEditedPostDirty(), |
6819 isDirty: isEditedPostDirty(), |
7300 isAutosaveable: isEditedPostAutosaveable(), |
6820 isAutosaveable: isEditedPostAutosaveable(), |
7301 editsReference: getReferenceByDistinctEdits(), |
6821 editsReference: getReferenceByDistinctEdits(), |
7302 isAutosaving: isAutosavingPost(), |
6822 isAutosaving: isAutosavingPost(), |
7303 autosaveInterval: autosaveInterval |
6823 interval: interval |
7304 }; |
6824 }; |
7305 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
6825 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { |
7306 return { |
6826 return { |
7307 autosave: dispatch('core/editor').autosave |
6827 autosave: function autosave() { |
6828 var _ownProps$autosave = ownProps.autosave, |
|
6829 autosave = _ownProps$autosave === void 0 ? dispatch('core/editor').autosave : _ownProps$autosave; |
|
6830 autosave(); |
|
6831 } |
|
7308 }; |
6832 }; |
7309 })])(autosave_monitor_AutosaveMonitor)); |
6833 })])(autosave_monitor_AutosaveMonitor)); |
7310 |
6834 |
7311 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
6835 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
7312 var classnames = __webpack_require__(16); |
6836 var classnames = __webpack_require__(11); |
7313 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
6837 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
7314 |
6838 |
7315 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js |
6839 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js |
7316 |
6840 |
7317 |
6841 |
7366 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js |
6890 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js |
7367 |
6891 |
7368 |
6892 |
7369 |
6893 |
7370 |
6894 |
6895 function document_outline_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
6896 |
|
6897 function document_outline_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { document_outline_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { document_outline_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6898 |
|
7371 /** |
6899 /** |
7372 * External dependencies |
6900 * External dependencies |
7373 */ |
6901 */ |
7374 |
6902 |
7375 /** |
6903 /** |
7419 */ |
6947 */ |
7420 |
6948 |
7421 var document_outline_computeOutlineHeadings = function computeOutlineHeadings() { |
6949 var document_outline_computeOutlineHeadings = function computeOutlineHeadings() { |
7422 var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
6950 var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
7423 var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
6951 var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
7424 return Object(external_lodash_["flatMap"])(blocks, function () { |
6952 return Object(external_this_lodash_["flatMap"])(blocks, function () { |
7425 var block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
6953 var block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
7426 |
6954 |
7427 if (block.name === 'core/heading') { |
6955 if (block.name === 'core/heading') { |
7428 return Object(objectSpread["a" /* default */])({}, block, { |
6956 return document_outline_objectSpread({}, block, { |
7429 path: path, |
6957 path: path, |
7430 level: block.attributes.level, |
6958 level: block.attributes.level, |
7431 isEmpty: isEmptyHeading(block) |
6959 isEmpty: isEmptyHeading(block) |
7432 }); |
6960 }); |
7433 } |
6961 } |
7455 |
6983 |
7456 var prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now. |
6984 var prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now. |
7457 |
6985 |
7458 var titleNode = document.querySelector('.editor-post-title__input'); |
6986 var titleNode = document.querySelector('.editor-post-title__input'); |
7459 var hasTitle = isTitleSupported && title && titleNode; |
6987 var hasTitle = isTitleSupported && title && titleNode; |
7460 var countByLevel = Object(external_lodash_["countBy"])(headings, 'level'); |
6988 var countByLevel = Object(external_this_lodash_["countBy"])(headings, 'level'); |
7461 var hasMultipleH1 = countByLevel[1] > 1; |
6989 var hasMultipleH1 = countByLevel[1] > 1; |
7462 return Object(external_this_wp_element_["createElement"])("div", { |
6990 return Object(external_this_wp_element_["createElement"])("div", { |
7463 className: "document-outline" |
6991 className: "document-outline" |
7464 }, Object(external_this_wp_element_["createElement"])("ul", null, hasTitle && Object(external_this_wp_element_["createElement"])(document_outline_item, { |
6992 }, Object(external_this_wp_element_["createElement"])("ul", null, hasTitle && Object(external_this_wp_element_["createElement"])(document_outline_item, { |
7465 level: Object(external_this_wp_i18n_["__"])('Title'), |
6993 level: Object(external_this_wp_i18n_["__"])('Title'), |
7498 |
7026 |
7499 var postType = getPostType(getEditedPostAttribute('type')); |
7027 var postType = getPostType(getEditedPostAttribute('type')); |
7500 return { |
7028 return { |
7501 title: getEditedPostAttribute('title'), |
7029 title: getEditedPostAttribute('title'), |
7502 blocks: getBlocks(), |
7030 blocks: getBlocks(), |
7503 isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false) |
7031 isTitleSupported: Object(external_this_lodash_["get"])(postType, ['supports', 'title'], false) |
7504 }; |
7032 }; |
7505 }))(document_outline_DocumentOutline)); |
7033 }))(document_outline_DocumentOutline)); |
7506 |
7034 |
7507 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js |
7035 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js |
7508 /** |
7036 /** |
7516 |
7044 |
7517 |
7045 |
7518 function DocumentOutlineCheck(_ref) { |
7046 function DocumentOutlineCheck(_ref) { |
7519 var blocks = _ref.blocks, |
7047 var blocks = _ref.blocks, |
7520 children = _ref.children; |
7048 children = _ref.children; |
7521 var headings = Object(external_lodash_["filter"])(blocks, function (block) { |
7049 var headings = Object(external_this_lodash_["filter"])(blocks, function (block) { |
7522 return block.name === 'core/heading'; |
7050 return block.name === 'core/heading'; |
7523 }); |
7051 }); |
7524 |
7052 |
7525 if (headings.length < 1) { |
7053 if (headings.length < 1) { |
7526 return null; |
7054 return null; |
7533 return { |
7061 return { |
7534 blocks: select('core/block-editor').getBlocks() |
7062 blocks: select('core/block-editor').getBlocks() |
7535 }; |
7063 }; |
7536 })(DocumentOutlineCheck)); |
7064 })(DocumentOutlineCheck)); |
7537 |
7065 |
7538 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
|
7539 var assertThisInitialized = __webpack_require__(3); |
|
7540 |
|
7541 // EXTERNAL MODULE: external {"this":["wp","keycodes"]} |
|
7542 var external_this_wp_keycodes_ = __webpack_require__(18); |
|
7543 |
|
7544 // EXTERNAL MODULE: external {"this":["wp","deprecated"]} |
|
7545 var external_this_wp_deprecated_ = __webpack_require__(49); |
|
7546 var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); |
|
7547 |
|
7548 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js |
7066 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js |
7549 |
|
7550 |
|
7551 |
|
7552 /** |
7067 /** |
7553 * WordPress dependencies |
7068 * WordPress dependencies |
7554 */ |
7069 */ |
7555 |
7070 |
7556 |
7071 |
7557 |
7072 |
7558 |
7073 |
7559 function SaveShortcut(_ref) { |
7074 function SaveShortcut(_ref) { |
7560 var onSave = _ref.onSave; |
7075 var resetBlocksOnSave = _ref.resetBlocksOnSave; |
7561 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { |
7076 |
7562 bindGlobal: true, |
7077 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), |
7563 shortcuts: Object(defineProperty["a" /* default */])({}, external_this_wp_keycodes_["rawShortcut"].primary('s'), function (event) { |
7078 resetEditorBlocks = _useDispatch.resetEditorBlocks, |
7564 event.preventDefault(); |
7079 savePost = _useDispatch.savePost; |
7565 onSave(); |
7080 |
7566 }) |
7081 var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { |
7082 var _select = select('core/editor'), |
|
7083 _isEditedPostDirty = _select.isEditedPostDirty, |
|
7084 _getPostEdits = _select.getPostEdits; |
|
7085 |
|
7086 return { |
|
7087 isEditedPostDirty: _isEditedPostDirty, |
|
7088 getPostEdits: _getPostEdits |
|
7089 }; |
|
7090 }, []), |
|
7091 isEditedPostDirty = _useSelect.isEditedPostDirty, |
|
7092 getPostEdits = _useSelect.getPostEdits; |
|
7093 |
|
7094 Object(external_this_wp_keyboardShortcuts_["useShortcut"])('core/editor/save', function (event) { |
|
7095 event.preventDefault(); // TODO: This should be handled in the `savePost` effect in |
|
7096 // considering `isSaveable`. See note on `isEditedPostSaveable` |
|
7097 // selector about dirtiness and meta-boxes. |
|
7098 // |
|
7099 // See: `isEditedPostSaveable` |
|
7100 |
|
7101 if (!isEditedPostDirty()) { |
|
7102 return; |
|
7103 } // The text editor requires that editor blocks are updated for a |
|
7104 // save to work correctly. Usually this happens when the textarea |
|
7105 // for the code editors blurs, but the shortcut can be used without |
|
7106 // blurring the textarea. |
|
7107 |
|
7108 |
|
7109 if (resetBlocksOnSave) { |
|
7110 var postEdits = getPostEdits(); |
|
7111 |
|
7112 if (postEdits.content && typeof postEdits.content === 'string') { |
|
7113 var blocks = Object(external_this_wp_blocks_["parse"])(postEdits.content); |
|
7114 resetEditorBlocks(blocks); |
|
7115 } |
|
7116 } |
|
7117 |
|
7118 savePost(); |
|
7119 }, { |
|
7120 bindGlobal: true |
|
7567 }); |
7121 }); |
7568 } |
7122 return null; |
7569 /* harmony default export */ var save_shortcut = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7123 } |
7570 var _select = select('core/editor'), |
7124 |
7571 isEditedPostDirty = _select.isEditedPostDirty; |
7125 /* harmony default export */ var save_shortcut = (SaveShortcut); |
7572 |
|
7573 return { |
|
7574 isDirty: isEditedPostDirty() |
|
7575 }; |
|
7576 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref3) { |
|
7577 var select = _ref3.select; |
|
7578 |
|
7579 var _dispatch = dispatch('core/editor'), |
|
7580 savePost = _dispatch.savePost; |
|
7581 |
|
7582 return { |
|
7583 onSave: function onSave() { |
|
7584 // TODO: This should be handled in the `savePost` effect in |
|
7585 // considering `isSaveable`. See note on `isEditedPostSaveable` |
|
7586 // selector about dirtiness and meta-boxes. |
|
7587 // |
|
7588 // See: `isEditedPostSaveable` |
|
7589 var _select2 = select('core/editor'), |
|
7590 isEditedPostDirty = _select2.isEditedPostDirty; |
|
7591 |
|
7592 if (!isEditedPostDirty()) { |
|
7593 return; |
|
7594 } |
|
7595 |
|
7596 savePost(); |
|
7597 } |
|
7598 }; |
|
7599 })])(SaveShortcut)); |
|
7600 |
7126 |
7601 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js |
7127 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js |
7602 |
7128 |
7603 |
7129 |
7604 |
|
7605 |
|
7606 |
|
7607 |
|
7608 |
|
7609 |
|
7610 |
|
7611 /** |
7130 /** |
7612 * WordPress dependencies |
7131 * WordPress dependencies |
7613 */ |
7132 */ |
7614 |
7133 |
7615 |
7134 |
7616 |
7135 |
7617 |
7136 |
7618 |
|
7619 |
|
7620 /** |
7137 /** |
7621 * Internal dependencies |
7138 * Internal dependencies |
7622 */ |
7139 */ |
7623 |
7140 |
7624 |
7141 |
7625 |
7142 |
7626 var visual_editor_shortcuts_VisualEditorGlobalKeyboardShortcuts = |
7143 function VisualEditorGlobalKeyboardShortcuts() { |
7627 /*#__PURE__*/ |
7144 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), |
7628 function (_Component) { |
7145 redo = _useDispatch.redo, |
7629 Object(inherits["a" /* default */])(VisualEditorGlobalKeyboardShortcuts, _Component); |
7146 undo = _useDispatch.undo; |
7630 |
7147 |
7631 function VisualEditorGlobalKeyboardShortcuts() { |
7148 Object(external_this_wp_keyboardShortcuts_["useShortcut"])('core/editor/undo', function (event) { |
7632 var _this; |
7149 undo(); |
7633 |
7150 event.preventDefault(); |
7634 Object(classCallCheck["a" /* default */])(this, VisualEditorGlobalKeyboardShortcuts); |
|
7635 |
|
7636 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(VisualEditorGlobalKeyboardShortcuts).apply(this, arguments)); |
|
7637 _this.undoOrRedo = _this.undoOrRedo.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
7638 return _this; |
|
7639 } |
|
7640 |
|
7641 Object(createClass["a" /* default */])(VisualEditorGlobalKeyboardShortcuts, [{ |
|
7642 key: "undoOrRedo", |
|
7643 value: function undoOrRedo(event) { |
|
7644 var _this$props = this.props, |
|
7645 onRedo = _this$props.onRedo, |
|
7646 onUndo = _this$props.onUndo; |
|
7647 |
|
7648 if (event.shiftKey) { |
|
7649 onRedo(); |
|
7650 } else { |
|
7651 onUndo(); |
|
7652 } |
|
7653 |
|
7654 event.preventDefault(); |
|
7655 } |
|
7656 }, { |
7151 }, { |
7657 key: "render", |
7152 bindGlobal: true |
7658 value: function render() { |
7153 }); |
7659 var _ref; |
7154 Object(external_this_wp_keyboardShortcuts_["useShortcut"])('core/editor/redo', function (event) { |
7660 |
7155 redo(); |
7661 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { |
7156 event.preventDefault(); |
7662 shortcuts: (_ref = {}, Object(defineProperty["a" /* default */])(_ref, external_this_wp_keycodes_["rawShortcut"].primary('z'), this.undoOrRedo), Object(defineProperty["a" /* default */])(_ref, external_this_wp_keycodes_["rawShortcut"].primaryShift('z'), this.undoOrRedo), _ref) |
7157 }, { |
7663 }), Object(external_this_wp_element_["createElement"])(save_shortcut, null)); |
7158 bindGlobal: true |
7664 } |
7159 }); |
7665 }]); |
7160 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(save_shortcut, null)); |
7666 |
7161 } |
7667 return VisualEditorGlobalKeyboardShortcuts; |
7162 |
7668 }(external_this_wp_element_["Component"]); |
7163 /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts); |
7669 |
|
7670 var EnhancedVisualEditorGlobalKeyboardShortcuts = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
|
7671 var _dispatch = dispatch('core/editor'), |
|
7672 redo = _dispatch.redo, |
|
7673 undo = _dispatch.undo; |
|
7674 |
|
7675 return { |
|
7676 onRedo: redo, |
|
7677 onUndo: undo |
|
7678 }; |
|
7679 })(visual_editor_shortcuts_VisualEditorGlobalKeyboardShortcuts); |
|
7680 /* harmony default export */ var visual_editor_shortcuts = (EnhancedVisualEditorGlobalKeyboardShortcuts); |
|
7681 function EditorGlobalKeyboardShortcuts() { |
7164 function EditorGlobalKeyboardShortcuts() { |
7682 external_this_wp_deprecated_default()('EditorGlobalKeyboardShortcuts', { |
7165 external_this_wp_deprecated_default()('EditorGlobalKeyboardShortcuts', { |
7683 alternative: 'VisualEditorGlobalKeyboardShortcuts', |
7166 alternative: 'VisualEditorGlobalKeyboardShortcuts', |
7684 plugin: 'Gutenberg' |
7167 plugin: 'Gutenberg' |
7685 }); |
7168 }); |
7686 return Object(external_this_wp_element_["createElement"])(EnhancedVisualEditorGlobalKeyboardShortcuts, null); |
7169 return Object(external_this_wp_element_["createElement"])(VisualEditorGlobalKeyboardShortcuts, null); |
7687 } |
7170 } |
7688 |
7171 |
7689 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js |
7172 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js |
7690 |
7173 |
7691 |
7174 |
7692 /** |
7175 /** |
7693 * Internal dependencies |
7176 * Internal dependencies |
7694 */ |
7177 */ |
7695 |
7178 |
7696 function TextEditorGlobalKeyboardShortcuts() { |
7179 function TextEditorGlobalKeyboardShortcuts() { |
7697 return Object(external_this_wp_element_["createElement"])(save_shortcut, null); |
7180 return Object(external_this_wp_element_["createElement"])(save_shortcut, { |
7698 } |
7181 resetBlocksOnSave: true |
7182 }); |
|
7183 } |
|
7184 |
|
7185 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js |
|
7186 |
|
7187 |
|
7188 /** |
|
7189 * WordPress dependencies |
|
7190 */ |
|
7191 |
|
7192 |
|
7193 |
|
7194 |
|
7195 |
|
7196 function EditorKeyboardShortcutsRegister() { |
|
7197 // Registering the shortcuts |
|
7198 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/keyboard-shortcuts'), |
|
7199 registerShortcut = _useDispatch.registerShortcut; |
|
7200 |
|
7201 Object(external_this_wp_element_["useEffect"])(function () { |
|
7202 registerShortcut({ |
|
7203 name: 'core/editor/save', |
|
7204 category: 'global', |
|
7205 description: Object(external_this_wp_i18n_["__"])('Save your changes.'), |
|
7206 keyCombination: { |
|
7207 modifier: 'primary', |
|
7208 character: 's' |
|
7209 } |
|
7210 }); |
|
7211 registerShortcut({ |
|
7212 name: 'core/editor/undo', |
|
7213 category: 'global', |
|
7214 description: Object(external_this_wp_i18n_["__"])('Undo your last changes.'), |
|
7215 keyCombination: { |
|
7216 modifier: 'primary', |
|
7217 character: 'z' |
|
7218 } |
|
7219 }); |
|
7220 registerShortcut({ |
|
7221 name: 'core/editor/redo', |
|
7222 category: 'global', |
|
7223 description: Object(external_this_wp_i18n_["__"])('Redo your last undo.'), |
|
7224 keyCombination: { |
|
7225 modifier: 'primaryShift', |
|
7226 character: 'z' |
|
7227 } |
|
7228 }); |
|
7229 }, [registerShortcut]); |
|
7230 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null); |
|
7231 } |
|
7232 |
|
7233 /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister); |
|
7234 |
|
7235 // EXTERNAL MODULE: external {"this":["wp","components"]} |
|
7236 var external_this_wp_components_ = __webpack_require__(3); |
|
7237 |
|
7238 // EXTERNAL MODULE: external {"this":["wp","keycodes"]} |
|
7239 var external_this_wp_keycodes_ = __webpack_require__(21); |
|
7240 |
|
7241 // EXTERNAL MODULE: external {"this":["wp","primitives"]} |
|
7242 var external_this_wp_primitives_ = __webpack_require__(6); |
|
7243 |
|
7244 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js |
|
7245 |
|
7246 |
|
7247 /** |
|
7248 * WordPress dependencies |
|
7249 */ |
|
7250 |
|
7251 var redo_redo = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
7252 xmlns: "http://www.w3.org/2000/svg", |
|
7253 viewBox: "0 0 24 24" |
|
7254 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
7255 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" |
|
7256 })); |
|
7257 /* harmony default export */ var library_redo = (redo_redo); |
|
7699 |
7258 |
7700 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js |
7259 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js |
7701 |
7260 |
7702 |
7261 |
7262 |
|
7703 /** |
7263 /** |
7704 * WordPress dependencies |
7264 * WordPress dependencies |
7705 */ |
7265 */ |
7706 |
7266 |
7707 |
7267 |
7708 |
7268 |
7709 |
7269 |
7710 |
7270 |
7711 |
7271 |
7712 function EditorHistoryRedo(_ref) { |
7272 |
7713 var hasRedo = _ref.hasRedo, |
7273 function EditorHistoryRedo(props, ref) { |
7714 redo = _ref.redo; |
7274 var hasRedo = Object(external_this_wp_data_["useSelect"])(function (select) { |
7715 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
7275 return select('core/editor').hasEditorRedo(); |
7716 icon: "redo", |
7276 }, []); |
7277 |
|
7278 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), |
|
7279 redo = _useDispatch.redo; |
|
7280 |
|
7281 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { |
|
7282 ref: ref, |
|
7283 icon: library_redo, |
|
7717 label: Object(external_this_wp_i18n_["__"])('Redo'), |
7284 label: Object(external_this_wp_i18n_["__"])('Redo'), |
7718 shortcut: external_this_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this |
7285 shortcut: external_this_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this |
7719 // button, because it will remove focus for keyboard users. |
7286 // button, because it will remove focus for keyboard users. |
7720 // See: https://github.com/WordPress/gutenberg/issues/3486 |
7287 // See: https://github.com/WordPress/gutenberg/issues/3486 |
7721 , |
7288 , |
7722 "aria-disabled": !hasRedo, |
7289 "aria-disabled": !hasRedo, |
7723 onClick: hasRedo ? redo : undefined, |
7290 onClick: hasRedo ? redo : undefined, |
7724 className: "editor-history__redo" |
7291 className: "editor-history__redo" |
7725 }); |
7292 })); |
7726 } |
7293 } |
7727 |
7294 |
7728 /* harmony default export */ var editor_history_redo = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7295 /* harmony default export */ var editor_history_redo = (Object(external_this_wp_element_["forwardRef"])(EditorHistoryRedo)); |
7729 return { |
7296 |
7730 hasRedo: select('core/editor').hasEditorRedo() |
7297 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js |
7731 }; |
7298 |
7732 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
7299 |
7733 return { |
7300 /** |
7734 redo: dispatch('core/editor').redo |
7301 * WordPress dependencies |
7735 }; |
7302 */ |
7736 })])(EditorHistoryRedo)); |
7303 |
7304 var undo_undo = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
7305 xmlns: "http://www.w3.org/2000/svg", |
|
7306 viewBox: "0 0 24 24" |
|
7307 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
7308 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" |
|
7309 })); |
|
7310 /* harmony default export */ var library_undo = (undo_undo); |
|
7737 |
7311 |
7738 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js |
7312 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js |
7739 |
7313 |
7740 |
7314 |
7315 |
|
7741 /** |
7316 /** |
7742 * WordPress dependencies |
7317 * WordPress dependencies |
7743 */ |
7318 */ |
7744 |
7319 |
7745 |
7320 |
7746 |
7321 |
7747 |
7322 |
7748 |
7323 |
7749 |
7324 |
7750 function EditorHistoryUndo(_ref) { |
7325 |
7751 var hasUndo = _ref.hasUndo, |
7326 function EditorHistoryUndo(props, ref) { |
7752 undo = _ref.undo; |
7327 var hasUndo = Object(external_this_wp_data_["useSelect"])(function (select) { |
7753 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
7328 return select('core/editor').hasEditorUndo(); |
7754 icon: "undo", |
7329 }, []); |
7330 |
|
7331 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), |
|
7332 undo = _useDispatch.undo; |
|
7333 |
|
7334 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { |
|
7335 ref: ref, |
|
7336 icon: library_undo, |
|
7755 label: Object(external_this_wp_i18n_["__"])('Undo'), |
7337 label: Object(external_this_wp_i18n_["__"])('Undo'), |
7756 shortcut: external_this_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this |
7338 shortcut: external_this_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this |
7757 // button, because it will remove focus for keyboard users. |
7339 // button, because it will remove focus for keyboard users. |
7758 // See: https://github.com/WordPress/gutenberg/issues/3486 |
7340 // See: https://github.com/WordPress/gutenberg/issues/3486 |
7759 , |
7341 , |
7760 "aria-disabled": !hasUndo, |
7342 "aria-disabled": !hasUndo, |
7761 onClick: hasUndo ? undo : undefined, |
7343 onClick: hasUndo ? undo : undefined, |
7762 className: "editor-history__undo" |
7344 className: "editor-history__undo" |
7763 }); |
7345 })); |
7764 } |
7346 } |
7765 |
7347 |
7766 /* harmony default export */ var editor_history_undo = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7348 /* harmony default export */ var editor_history_undo = (Object(external_this_wp_element_["forwardRef"])(EditorHistoryUndo)); |
7767 return { |
|
7768 hasUndo: select('core/editor').hasEditorUndo() |
|
7769 }; |
|
7770 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
|
7771 return { |
|
7772 undo: dispatch('core/editor').undo |
|
7773 }; |
|
7774 })])(EditorHistoryUndo)); |
|
7775 |
7349 |
7776 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js |
7350 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js |
7777 |
7351 |
7778 |
7352 |
7779 |
7353 |
7792 if (isValid) { |
7366 if (isValid) { |
7793 return null; |
7367 return null; |
7794 } |
7368 } |
7795 |
7369 |
7796 var confirmSynchronization = function confirmSynchronization() { |
7370 var confirmSynchronization = function confirmSynchronization() { |
7797 // eslint-disable-next-line no-alert |
7371 if ( // eslint-disable-next-line no-alert |
7798 if (window.confirm(Object(external_this_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) { |
7372 window.confirm(Object(external_this_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) { |
7799 props.synchronizeTemplate(); |
7373 props.synchronizeTemplate(); |
7800 } |
7374 } |
7801 }; |
7375 }; |
7802 |
7376 |
7803 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], { |
7377 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], { |
7804 className: "editor-template-validation-notice", |
7378 className: "editor-template-validation-notice", |
7805 isDismissible: false, |
7379 isDismissible: false, |
7806 status: "warning" |
7380 status: "warning", |
7807 }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')), Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
7381 actions: [{ |
7808 isDefault: true, |
7382 label: Object(external_this_wp_i18n_["__"])('Keep it as is'), |
7809 onClick: props.resetTemplateValidity |
7383 onClick: props.resetTemplateValidity |
7810 }, Object(external_this_wp_i18n_["__"])('Keep it as is')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
7384 }, { |
7811 onClick: confirmSynchronization, |
7385 label: Object(external_this_wp_i18n_["__"])('Reset the template'), |
7812 isPrimary: true |
7386 onClick: confirmSynchronization, |
7813 }, Object(external_this_wp_i18n_["__"])('Reset the template')))); |
7387 isPrimary: true |
7388 }] |
|
7389 }, Object(external_this_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')); |
|
7814 } |
7390 } |
7815 |
7391 |
7816 /* harmony default export */ var template_validation_notice = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7392 /* harmony default export */ var template_validation_notice = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7817 return { |
7393 return { |
7818 isValid: select('core/block-editor').isValidTemplate() |
7394 isValid: select('core/block-editor').isValidTemplate() |
7831 })])(TemplateValidationNotice)); |
7407 })])(TemplateValidationNotice)); |
7832 |
7408 |
7833 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js |
7409 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js |
7834 |
7410 |
7835 |
7411 |
7836 |
|
7837 |
|
7838 /** |
7412 /** |
7839 * External dependencies |
7413 * External dependencies |
7840 */ |
7414 */ |
7841 |
7415 |
7842 /** |
7416 /** |
7850 * Internal dependencies |
7424 * Internal dependencies |
7851 */ |
7425 */ |
7852 |
7426 |
7853 |
7427 |
7854 function EditorNotices(_ref) { |
7428 function EditorNotices(_ref) { |
7855 var dismissible = _ref.dismissible, |
7429 var notices = _ref.notices, |
7856 notices = _ref.notices, |
7430 onRemove = _ref.onRemove; |
7857 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["dismissible", "notices"]); |
7431 var dismissibleNotices = Object(external_this_lodash_["filter"])(notices, { |
7858 |
7432 isDismissible: true, |
7859 if (dismissible !== undefined) { |
7433 type: 'default' |
7860 notices = Object(external_lodash_["filter"])(notices, { |
7434 }); |
7861 isDismissible: dismissible |
7435 var nonDismissibleNotices = Object(external_this_lodash_["filter"])(notices, { |
7862 }); |
7436 isDismissible: false, |
7863 } |
7437 type: 'default' |
7864 |
7438 }); |
7865 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], Object(esm_extends["a" /* default */])({ |
7439 var snackbarNotices = Object(external_this_lodash_["filter"])(notices, { |
7866 notices: notices |
7440 type: 'snackbar' |
7867 }, props), dismissible !== false && Object(external_this_wp_element_["createElement"])(template_validation_notice, null)); |
7441 }); |
7442 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], { |
|
7443 notices: nonDismissibleNotices, |
|
7444 className: "components-editor-notices__pinned" |
|
7445 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], { |
|
7446 notices: dismissibleNotices, |
|
7447 className: "components-editor-notices__dismissible", |
|
7448 onRemove: onRemove |
|
7449 }, Object(external_this_wp_element_["createElement"])(template_validation_notice, null)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SnackbarList"], { |
|
7450 notices: snackbarNotices, |
|
7451 className: "components-editor-notices__snackbar", |
|
7452 onRemove: onRemove |
|
7453 })); |
|
7868 } |
7454 } |
7869 /* harmony default export */ var editor_notices = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7455 /* harmony default export */ var editor_notices = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
7870 return { |
7456 return { |
7871 notices: select('core/notices').getNotices() |
7457 notices: select('core/notices').getNotices() |
7872 }; |
7458 }; |
7874 return { |
7460 return { |
7875 onRemove: dispatch('core/notices').removeNotice |
7461 onRemove: dispatch('core/notices').removeNotice |
7876 }; |
7462 }; |
7877 })])(EditorNotices)); |
7463 })])(EditorNotices)); |
7878 |
7464 |
7465 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
|
7466 var library_close = __webpack_require__(154); |
|
7467 |
|
7468 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js |
|
7469 var layout = __webpack_require__(298); |
|
7470 |
|
7471 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js |
|
7472 |
|
7473 |
|
7474 /** |
|
7475 * WordPress dependencies |
|
7476 */ |
|
7477 |
|
7478 var page_page = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
7479 xmlns: "http://www.w3.org/2000/svg", |
|
7480 viewBox: "0 0 24 24" |
|
7481 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
7482 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" |
|
7483 })); |
|
7484 /* harmony default export */ var library_page = (page_page); |
|
7485 |
|
7486 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js |
|
7487 var grid = __webpack_require__(302); |
|
7488 |
|
7489 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
|
7490 var block_default = __webpack_require__(202); |
|
7491 |
|
7492 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js |
|
7493 |
|
7494 |
|
7495 /** |
|
7496 * WordPress dependencies |
|
7497 */ |
|
7498 |
|
7499 |
|
7500 |
|
7501 |
|
7502 function EntityRecordItem(_ref) { |
|
7503 var record = _ref.record, |
|
7504 checked = _ref.checked, |
|
7505 onChange = _ref.onChange, |
|
7506 closePanel = _ref.closePanel; |
|
7507 var name = record.name, |
|
7508 kind = record.kind, |
|
7509 title = record.title, |
|
7510 key = record.key; |
|
7511 var parentBlockId = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
7512 var _blocks$; |
|
7513 |
|
7514 // Get entity's blocks. |
|
7515 var _select$getEditedEnti = select('core').getEditedEntityRecord(kind, name, key), |
|
7516 _select$getEditedEnti2 = _select$getEditedEnti.blocks, |
|
7517 blocks = _select$getEditedEnti2 === void 0 ? [] : _select$getEditedEnti2; // Get parents of the entity's first block. |
|
7518 |
|
7519 |
|
7520 var parents = select('core/block-editor').getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId. |
|
7521 |
|
7522 return parents[parents.length - 1]; |
|
7523 }, []); |
|
7524 var isSelected = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
7525 var selectedBlockId = select('core/block-editor').getSelectedBlockClientId(); |
|
7526 return selectedBlockId === parentBlockId; |
|
7527 }, [parentBlockId]); |
|
7528 var isSelectedText = isSelected ? Object(external_this_wp_i18n_["__"])('Selected') : Object(external_this_wp_i18n_["__"])('Select'); |
|
7529 |
|
7530 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'), |
|
7531 selectBlock = _useDispatch.selectBlock; |
|
7532 |
|
7533 var selectParentBlock = Object(external_this_wp_element_["useCallback"])(function () { |
|
7534 return selectBlock(parentBlockId); |
|
7535 }, [parentBlockId]); |
|
7536 var selectAndDismiss = Object(external_this_wp_element_["useCallback"])(function () { |
|
7537 selectBlock(parentBlockId); |
|
7538 closePanel(); |
|
7539 }, [parentBlockId]); |
|
7540 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelRow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
|
7541 label: Object(external_this_wp_element_["createElement"])("strong", null, title || Object(external_this_wp_i18n_["__"])('Untitled')), |
|
7542 checked: checked, |
|
7543 onChange: onChange |
|
7544 }), parentBlockId ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
7545 onClick: selectParentBlock, |
|
7546 className: "entities-saved-states__find-entity", |
|
7547 disabled: isSelected |
|
7548 }, isSelectedText), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
7549 onClick: selectAndDismiss, |
|
7550 className: "entities-saved-states__find-entity-small", |
|
7551 disabled: isSelected |
|
7552 }, isSelectedText)) : null); |
|
7553 } |
|
7554 |
|
7555 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js |
|
7556 |
|
7557 |
|
7558 /** |
|
7559 * External dependencies |
|
7560 */ |
|
7561 |
|
7562 /** |
|
7563 * WordPress dependencies |
|
7564 */ |
|
7565 |
|
7566 |
|
7567 |
|
7568 |
|
7569 /** |
|
7570 * Internal dependencies |
|
7571 */ |
|
7572 |
|
7573 |
|
7574 var ENTITY_NAME_ICONS = { |
|
7575 site: layout["a" /* default */], |
|
7576 page: library_page, |
|
7577 post: grid["a" /* default */], |
|
7578 wp_template: grid["a" /* default */] |
|
7579 }; |
|
7580 function EntityTypeList(_ref) { |
|
7581 var list = _ref.list, |
|
7582 unselectedEntities = _ref.unselectedEntities, |
|
7583 setUnselectedEntities = _ref.setUnselectedEntities, |
|
7584 closePanel = _ref.closePanel; |
|
7585 var firstRecord = list[0]; |
|
7586 var entity = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
7587 return select('core').getEntity(firstRecord.kind, firstRecord.name); |
|
7588 }, [firstRecord.kind, firstRecord.name]); // Set icon based on type of entity. |
|
7589 |
|
7590 var name = firstRecord.name; |
|
7591 var icon = ENTITY_NAME_ICONS[name] || block_default["a" /* default */]; |
|
7592 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { |
|
7593 title: entity.label, |
|
7594 initialOpen: true, |
|
7595 icon: icon |
|
7596 }, list.map(function (record) { |
|
7597 return Object(external_this_wp_element_["createElement"])(EntityRecordItem, { |
|
7598 key: record.key || 'site', |
|
7599 record: record, |
|
7600 checked: !Object(external_this_lodash_["some"])(unselectedEntities, function (elt) { |
|
7601 return elt.kind === record.kind && elt.name === record.name && elt.key === record.key; |
|
7602 }), |
|
7603 onChange: function onChange(value) { |
|
7604 return setUnselectedEntities(record, value); |
|
7605 }, |
|
7606 closePanel: closePanel |
|
7607 }); |
|
7608 })); |
|
7609 } |
|
7610 |
|
7611 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js |
|
7612 |
|
7613 |
|
7614 |
|
7615 |
|
7616 /** |
|
7617 * External dependencies |
|
7618 */ |
|
7619 |
|
7620 /** |
|
7621 * WordPress dependencies |
|
7622 */ |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 /** |
|
7630 * Internal dependencies |
|
7631 */ |
|
7632 |
|
7633 |
|
7634 var ENTITY_NAMES = { |
|
7635 wp_template_part: function wp_template_part(number) { |
|
7636 return Object(external_this_wp_i18n_["_n"])('template part', 'template parts', number); |
|
7637 }, |
|
7638 wp_template: function wp_template(number) { |
|
7639 return Object(external_this_wp_i18n_["_n"])('template', 'templates', number); |
|
7640 }, |
|
7641 post: function post(number) { |
|
7642 return Object(external_this_wp_i18n_["_n"])('post', 'posts', number); |
|
7643 }, |
|
7644 page: function page(number) { |
|
7645 return Object(external_this_wp_i18n_["_n"])('page', 'pages', number); |
|
7646 }, |
|
7647 site: function site(number) { |
|
7648 return Object(external_this_wp_i18n_["_n"])('site', 'sites', number); |
|
7649 } |
|
7650 }; |
|
7651 var PLACEHOLDER_PHRASES = { |
|
7652 // 0 is a back up, but should never be observed. |
|
7653 0: Object(external_this_wp_i18n_["__"])('There are no changes.'), |
|
7654 |
|
7655 /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ |
|
7656 1: Object(external_this_wp_i18n_["__"])('Changes have been made to your %s.'), |
|
7657 |
|
7658 /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ |
|
7659 2: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s and %2$s.'), |
|
7660 |
|
7661 /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ |
|
7662 3: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s, %2$s, and %3$s.'), |
|
7663 |
|
7664 /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ |
|
7665 4: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s, %2$s, %3$s, and %4$s.'), |
|
7666 |
|
7667 /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ |
|
7668 5: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s, %2$s, %3$s, %4$s, and %5$s.') |
|
7669 }; |
|
7670 function EntitiesSavedStates(_ref) { |
|
7671 var isOpen = _ref.isOpen, |
|
7672 close = _ref.close; |
|
7673 |
|
7674 var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
7675 return { |
|
7676 dirtyEntityRecords: select('core').__experimentalGetDirtyEntityRecords() |
|
7677 }; |
|
7678 }, []), |
|
7679 dirtyEntityRecords = _useSelect.dirtyEntityRecords; |
|
7680 |
|
7681 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core'), |
|
7682 saveEditedEntityRecord = _useDispatch.saveEditedEntityRecord; // To group entities by type. |
|
7683 |
|
7684 |
|
7685 var partitionedSavables = Object.values(Object(external_this_lodash_["groupBy"])(dirtyEntityRecords, 'name')); // Get labels for text-prompt phrase. |
|
7686 |
|
7687 var entityNamesForPrompt = []; |
|
7688 partitionedSavables.forEach(function (list) { |
|
7689 if (ENTITY_NAMES[list[0].name]) { |
|
7690 entityNamesForPrompt.push(ENTITY_NAMES[list[0].name](list.length)); |
|
7691 } |
|
7692 }); // Get text-prompt phrase based on number of entity types changed. |
|
7693 |
|
7694 var placeholderPhrase = PLACEHOLDER_PHRASES[entityNamesForPrompt.length] || // Fallback for edge case that should not be observed (more than 5 entity types edited). |
|
7695 Object(external_this_wp_i18n_["__"])('Changes have been made to multiple entity types.'); // eslint-disable-next-line @wordpress/valid-sprintf |
|
7696 |
|
7697 |
|
7698 var promptPhrase = external_this_wp_i18n_["sprintf"].apply(void 0, [placeholderPhrase].concat(entityNamesForPrompt)); // Unchecked entities to be ignored by save function. |
|
7699 |
|
7700 var _useState = Object(external_this_wp_element_["useState"])([]), |
|
7701 _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), |
|
7702 unselectedEntities = _useState2[0], |
|
7703 _setUnselectedEntities = _useState2[1]; |
|
7704 |
|
7705 var setUnselectedEntities = function setUnselectedEntities(_ref2, checked) { |
|
7706 var kind = _ref2.kind, |
|
7707 name = _ref2.name, |
|
7708 key = _ref2.key; |
|
7709 |
|
7710 if (checked) { |
|
7711 _setUnselectedEntities(unselectedEntities.filter(function (elt) { |
|
7712 return elt.kind !== kind || elt.name !== name || elt.key !== key; |
|
7713 })); |
|
7714 } else { |
|
7715 _setUnselectedEntities([].concat(Object(toConsumableArray["a" /* default */])(unselectedEntities), [{ |
|
7716 kind: kind, |
|
7717 name: name, |
|
7718 key: key |
|
7719 }])); |
|
7720 } |
|
7721 }; |
|
7722 |
|
7723 var saveCheckedEntities = function saveCheckedEntities() { |
|
7724 var entitiesToSave = dirtyEntityRecords.filter(function (_ref3) { |
|
7725 var kind = _ref3.kind, |
|
7726 name = _ref3.name, |
|
7727 key = _ref3.key; |
|
7728 return !Object(external_this_lodash_["some"])(unselectedEntities, function (elt) { |
|
7729 return elt.kind === kind && elt.name === name && elt.key === key; |
|
7730 }); |
|
7731 }); |
|
7732 close(entitiesToSave); |
|
7733 entitiesToSave.forEach(function (_ref4) { |
|
7734 var kind = _ref4.kind, |
|
7735 name = _ref4.name, |
|
7736 key = _ref4.key; |
|
7737 saveEditedEntityRecord(kind, name, key); |
|
7738 }); |
|
7739 }; |
|
7740 |
|
7741 var _useState3 = Object(external_this_wp_element_["useState"])(false), |
|
7742 _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), |
|
7743 isReviewing = _useState4[0], |
|
7744 setIsReviewing = _useState4[1]; |
|
7745 |
|
7746 var toggleIsReviewing = function toggleIsReviewing() { |
|
7747 return setIsReviewing(function (value) { |
|
7748 return !value; |
|
7749 }); |
|
7750 }; // Explicitly define this with no argument passed. Using `close` on |
|
7751 // its own will use the event object in place of the expected saved entities. |
|
7752 |
|
7753 |
|
7754 var dismissPanel = Object(external_this_wp_element_["useCallback"])(function () { |
|
7755 return close(); |
|
7756 }, [close]); |
|
7757 return isOpen ? Object(external_this_wp_element_["createElement"])("div", { |
|
7758 className: "entities-saved-states__panel" |
|
7759 }, Object(external_this_wp_element_["createElement"])("div", { |
|
7760 className: "entities-saved-states__panel-header" |
|
7761 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
7762 isPrimary: true, |
|
7763 disabled: dirtyEntityRecords.length - unselectedEntities.length === 0, |
|
7764 onClick: saveCheckedEntities, |
|
7765 className: "editor-entities-saved-states__save-button" |
|
7766 }, Object(external_this_wp_i18n_["__"])('Save')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
7767 onClick: dismissPanel, |
|
7768 icon: library_close["a" /* default */], |
|
7769 label: Object(external_this_wp_i18n_["__"])('Close panel') |
|
7770 })), Object(external_this_wp_element_["createElement"])("div", { |
|
7771 className: "entities-saved-states__text-prompt" |
|
7772 }, Object(external_this_wp_element_["createElement"])("strong", null, Object(external_this_wp_i18n_["__"])('Are you ready to save?')), Object(external_this_wp_element_["createElement"])("p", null, promptPhrase), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
7773 onClick: toggleIsReviewing, |
|
7774 isLink: true, |
|
7775 className: "entities-saved-states__review-changes-button" |
|
7776 }, isReviewing ? Object(external_this_wp_i18n_["__"])('Hide changes.') : Object(external_this_wp_i18n_["__"])('Review changes.')))), isReviewing && partitionedSavables.map(function (list) { |
|
7777 return Object(external_this_wp_element_["createElement"])(EntityTypeList, { |
|
7778 key: list[0].name, |
|
7779 list: list, |
|
7780 closePanel: dismissPanel, |
|
7781 unselectedEntities: unselectedEntities, |
|
7782 setUnselectedEntities: setUnselectedEntities |
|
7783 }); |
|
7784 })) : null; |
|
7785 } |
|
7786 |
|
7787 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
|
7788 var assertThisInitialized = __webpack_require__(12); |
|
7789 |
|
7879 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js |
7790 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js |
7880 |
7791 |
7881 |
7792 |
7882 |
7793 |
7883 |
7794 |
7884 |
7795 |
7885 |
7796 |
7886 |
7797 |
7887 |
7798 |
7799 function error_boundary_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (error_boundary_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
7800 |
|
7801 function error_boundary_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
7802 |
|
7888 /** |
7803 /** |
7889 * WordPress dependencies |
7804 * WordPress dependencies |
7890 */ |
7805 */ |
7891 |
7806 |
7892 |
7807 |
7893 |
7808 |
7894 |
7809 |
7895 |
7810 |
7896 |
7811 |
7897 var error_boundary_ErrorBoundary = |
7812 var error_boundary_ErrorBoundary = /*#__PURE__*/function (_Component) { |
7898 /*#__PURE__*/ |
|
7899 function (_Component) { |
|
7900 Object(inherits["a" /* default */])(ErrorBoundary, _Component); |
7813 Object(inherits["a" /* default */])(ErrorBoundary, _Component); |
7814 |
|
7815 var _super = error_boundary_createSuper(ErrorBoundary); |
|
7901 |
7816 |
7902 function ErrorBoundary() { |
7817 function ErrorBoundary() { |
7903 var _this; |
7818 var _this; |
7904 |
7819 |
7905 Object(classCallCheck["a" /* default */])(this, ErrorBoundary); |
7820 Object(classCallCheck["a" /* default */])(this, ErrorBoundary); |
7906 |
7821 |
7907 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ErrorBoundary).apply(this, arguments)); |
7822 _this = _super.apply(this, arguments); |
7908 _this.reboot = _this.reboot.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
7823 _this.reboot = _this.reboot.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
7909 _this.getContent = _this.getContent.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
7824 _this.getContent = _this.getContent.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
7910 _this.state = { |
7825 _this.state = { |
7911 error: null |
7826 error: null |
7912 }; |
7827 }; |
7913 return _this; |
7828 return _this; |
7914 } |
7829 } |
7950 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["Warning"], { |
7865 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["Warning"], { |
7951 className: "editor-error-boundary", |
7866 className: "editor-error-boundary", |
7952 actions: [Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
7867 actions: [Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
7953 key: "recovery", |
7868 key: "recovery", |
7954 onClick: this.reboot, |
7869 onClick: this.reboot, |
7955 isLarge: true |
7870 isSecondary: true |
7956 }, Object(external_this_wp_i18n_["__"])('Attempt Recovery')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
7871 }, Object(external_this_wp_i18n_["__"])('Attempt Recovery')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
7957 key: "copy-post", |
7872 key: "copy-post", |
7958 text: this.getContent, |
7873 text: this.getContent, |
7959 isLarge: true |
7874 isSecondary: true |
7960 }, Object(external_this_wp_i18n_["__"])('Copy Post Text')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
7875 }, Object(external_this_wp_i18n_["__"])('Copy Post Text')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
7961 key: "copy-error", |
7876 key: "copy-error", |
7962 text: error.stack, |
7877 text: error.stack, |
7963 isLarge: true |
7878 isSecondary: true |
7964 }, Object(external_this_wp_i18n_["__"])('Copy Error'))] |
7879 }, Object(external_this_wp_i18n_["__"])('Copy Error'))] |
7965 }, Object(external_this_wp_i18n_["__"])('The editor has encountered an unexpected error.')); |
7880 }, Object(external_this_wp_i18n_["__"])('The editor has encountered an unexpected error.')); |
7966 } |
7881 } |
7967 }]); |
7882 }]); |
7968 |
7883 |
7969 return ErrorBoundary; |
7884 return ErrorBoundary; |
7970 }(external_this_wp_element_["Component"]); |
7885 }(external_this_wp_element_["Component"]); |
7971 |
7886 |
7972 /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary); |
7887 /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary); |
7888 |
|
7889 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js |
|
7890 |
|
7891 |
|
7892 /** |
|
7893 * External dependencies |
|
7894 */ |
|
7895 |
|
7896 /** |
|
7897 * WordPress dependencies |
|
7898 */ |
|
7899 |
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 |
|
7905 /** |
|
7906 * Internal dependencies |
|
7907 */ |
|
7908 |
|
7909 |
|
7910 |
|
7911 var requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; |
|
7912 /** |
|
7913 * Function which returns true if the current environment supports browser |
|
7914 * sessionStorage, or false otherwise. The result of this function is cached and |
|
7915 * reused in subsequent invocations. |
|
7916 */ |
|
7917 |
|
7918 var hasSessionStorageSupport = Object(external_this_lodash_["once"])(function () { |
|
7919 try { |
|
7920 // Private Browsing in Safari 10 and earlier will throw an error when |
|
7921 // attempting to set into sessionStorage. The test here is intentional in |
|
7922 // causing a thrown error as condition bailing from local autosave. |
|
7923 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); |
|
7924 window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); |
|
7925 return true; |
|
7926 } catch (error) { |
|
7927 return false; |
|
7928 } |
|
7929 }); |
|
7930 /** |
|
7931 * Custom hook which manages the creation of a notice prompting the user to |
|
7932 * restore a local autosave, if one exists. |
|
7933 */ |
|
7934 |
|
7935 function useAutosaveNotice() { |
|
7936 var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
7937 return { |
|
7938 postId: select('core/editor').getCurrentPostId(), |
|
7939 getEditedPostAttribute: select('core/editor').getEditedPostAttribute, |
|
7940 hasRemoteAutosave: !!select('core/editor').getEditorSettings().autosave |
|
7941 }; |
|
7942 }, []), |
|
7943 postId = _useSelect.postId, |
|
7944 getEditedPostAttribute = _useSelect.getEditedPostAttribute, |
|
7945 hasRemoteAutosave = _useSelect.hasRemoteAutosave; |
|
7946 |
|
7947 var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/notices'), |
|
7948 createWarningNotice = _useDispatch.createWarningNotice, |
|
7949 removeNotice = _useDispatch.removeNotice; |
|
7950 |
|
7951 var _useDispatch2 = Object(external_this_wp_data_["useDispatch"])('core/editor'), |
|
7952 editPost = _useDispatch2.editPost, |
|
7953 resetEditorBlocks = _useDispatch2.resetEditorBlocks; |
|
7954 |
|
7955 Object(external_this_wp_element_["useEffect"])(function () { |
|
7956 var localAutosave = localAutosaveGet(postId); |
|
7957 |
|
7958 if (!localAutosave) { |
|
7959 return; |
|
7960 } |
|
7961 |
|
7962 try { |
|
7963 localAutosave = JSON.parse(localAutosave); |
|
7964 } catch (error) { |
|
7965 // Not usable if it can't be parsed. |
|
7966 return; |
|
7967 } |
|
7968 |
|
7969 var _localAutosave = localAutosave, |
|
7970 title = _localAutosave.post_title, |
|
7971 content = _localAutosave.content, |
|
7972 excerpt = _localAutosave.excerpt; |
|
7973 var edits = { |
|
7974 title: title, |
|
7975 content: content, |
|
7976 excerpt: excerpt |
|
7977 }; |
|
7978 { |
|
7979 // Only display a notice if there is a difference between what has been |
|
7980 // saved and that which is stored in sessionStorage. |
|
7981 var hasDifference = Object.keys(edits).some(function (key) { |
|
7982 return edits[key] !== getEditedPostAttribute(key); |
|
7983 }); |
|
7984 |
|
7985 if (!hasDifference) { |
|
7986 // If there is no difference, it can be safely ejected from storage. |
|
7987 localAutosaveClear(postId); |
|
7988 return; |
|
7989 } |
|
7990 } |
|
7991 |
|
7992 if (hasRemoteAutosave) { |
|
7993 return; |
|
7994 } |
|
7995 |
|
7996 var noticeId = Object(external_this_lodash_["uniqueId"])('wpEditorAutosaveRestore'); |
|
7997 createWarningNotice(Object(external_this_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), { |
|
7998 id: noticeId, |
|
7999 actions: [{ |
|
8000 label: Object(external_this_wp_i18n_["__"])('Restore the backup'), |
|
8001 onClick: function onClick() { |
|
8002 editPost(Object(external_this_lodash_["omit"])(edits, ['content'])); |
|
8003 resetEditorBlocks(Object(external_this_wp_blocks_["parse"])(edits.content)); |
|
8004 removeNotice(noticeId); |
|
8005 } |
|
8006 }] |
|
8007 }); |
|
8008 }, [postId]); |
|
8009 } |
|
8010 /** |
|
8011 * Custom hook which ejects a local autosave after a successful save occurs. |
|
8012 */ |
|
8013 |
|
8014 |
|
8015 function useAutosavePurge() { |
|
8016 var _useSelect2 = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
8017 return { |
|
8018 postId: select('core/editor').getCurrentPostId(), |
|
8019 isDirty: select('core/editor').isEditedPostDirty(), |
|
8020 isAutosaving: select('core/editor').isAutosavingPost(), |
|
8021 didError: select('core/editor').didPostSaveRequestFail() |
|
8022 }; |
|
8023 }, []), |
|
8024 postId = _useSelect2.postId, |
|
8025 isDirty = _useSelect2.isDirty, |
|
8026 isAutosaving = _useSelect2.isAutosaving, |
|
8027 didError = _useSelect2.didError; |
|
8028 |
|
8029 var lastIsDirty = Object(external_this_wp_element_["useRef"])(isDirty); |
|
8030 var lastIsAutosaving = Object(external_this_wp_element_["useRef"])(isAutosaving); |
|
8031 Object(external_this_wp_element_["useEffect"])(function () { |
|
8032 if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) { |
|
8033 localAutosaveClear(postId); |
|
8034 } |
|
8035 |
|
8036 lastIsDirty.current = isDirty; |
|
8037 lastIsAutosaving.current = isAutosaving; |
|
8038 }, [isDirty, isAutosaving, didError]); |
|
8039 } |
|
8040 |
|
8041 function LocalAutosaveMonitor() { |
|
8042 var _useDispatch3 = Object(external_this_wp_data_["useDispatch"])('core/editor'), |
|
8043 __experimentalLocalAutosave = _useDispatch3.__experimentalLocalAutosave; |
|
8044 |
|
8045 var autosave = Object(external_this_wp_element_["useCallback"])(function () { |
|
8046 requestIdleCallback(__experimentalLocalAutosave); |
|
8047 }, []); |
|
8048 useAutosaveNotice(); |
|
8049 useAutosavePurge(); |
|
8050 |
|
8051 var _useSelect3 = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
8052 return { |
|
8053 localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval |
|
8054 }; |
|
8055 }, []), |
|
8056 localAutosaveInterval = _useSelect3.localAutosaveInterval; |
|
8057 |
|
8058 return Object(external_this_wp_element_["createElement"])(autosave_monitor, { |
|
8059 interval: localAutosaveInterval, |
|
8060 autosave: autosave, |
|
8061 shouldThrottle: true |
|
8062 }); |
|
8063 } |
|
8064 |
|
8065 /* harmony default export */ var local_autosave_monitor = (Object(external_this_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor)); |
|
7973 |
8066 |
7974 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js |
8067 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js |
7975 /** |
8068 /** |
7976 * External dependencies |
8069 * External dependencies |
7977 */ |
8070 */ |
7983 |
8076 |
7984 function PageAttributesCheck(_ref) { |
8077 function PageAttributesCheck(_ref) { |
7985 var availableTemplates = _ref.availableTemplates, |
8078 var availableTemplates = _ref.availableTemplates, |
7986 postType = _ref.postType, |
8079 postType = _ref.postType, |
7987 children = _ref.children; |
8080 children = _ref.children; |
7988 var supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. |
8081 var supportsPageAttributes = Object(external_this_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. |
7989 |
8082 |
7990 if (!supportsPageAttributes && Object(external_lodash_["isEmpty"])(availableTemplates)) { |
8083 if (!supportsPageAttributes && Object(external_this_lodash_["isEmpty"])(availableTemplates)) { |
7991 return null; |
8084 return null; |
7992 } |
8085 } |
7993 |
8086 |
7994 return children; |
8087 return children; |
7995 } |
8088 } |
8022 |
8115 |
8023 /** |
8116 /** |
8024 * A component which renders its own children only if the current editor post |
8117 * A component which renders its own children only if the current editor post |
8025 * type supports one of the given `supportKeys` prop. |
8118 * type supports one of the given `supportKeys` prop. |
8026 * |
8119 * |
8027 * @param {?Object} props.postType Current post type. |
8120 * @param {Object} props Props. |
8028 * @param {WPElement} props.children Children to be rendered if post |
8121 * @param {string} [props.postType] Current post type. |
8029 * type supports. |
8122 * @param {WPElement} props.children Children to be rendered if post |
8030 * @param {(string|string[])} props.supportKeys String or string array of keys |
8123 * type supports. |
8031 * to test. |
8124 * @param {(string|string[])} props.supportKeys String or string array of keys |
8032 * |
8125 * to test. |
8033 * @return {WPElement} Rendered element. |
8126 * |
8127 * @return {WPComponent} The component to be rendered. |
|
8034 */ |
8128 */ |
8035 |
8129 |
8036 function PostTypeSupportCheck(_ref) { |
8130 function PostTypeSupportCheck(_ref) { |
8037 var postType = _ref.postType, |
8131 var postType = _ref.postType, |
8038 children = _ref.children, |
8132 children = _ref.children, |
8039 supportKeys = _ref.supportKeys; |
8133 supportKeys = _ref.supportKeys; |
8040 var isSupported = true; |
8134 var isSupported = true; |
8041 |
8135 |
8042 if (postType) { |
8136 if (postType) { |
8043 isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) { |
8137 isSupported = Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(supportKeys), function (key) { |
8044 return !!postType.supports[key]; |
8138 return !!postType.supports[key]; |
8045 }); |
8139 }); |
8046 } |
8140 } |
8047 |
8141 |
8048 if (!isSupported) { |
8142 if (!isSupported) { |
8096 setState({ |
8190 setState({ |
8097 orderInput: value |
8191 orderInput: value |
8098 }); |
8192 }); |
8099 var newOrder = Number(value); |
8193 var newOrder = Number(value); |
8100 |
8194 |
8101 if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') { |
8195 if (Number.isInteger(newOrder) && Object(external_this_lodash_["invoke"])(value, ['trim']) !== '') { |
8102 onUpdateOrder(Number(value)); |
8196 onUpdateOrder(Number(value)); |
8103 } |
8197 } |
8104 }; |
8198 }; |
8105 |
8199 |
8106 var value = orderInput === null ? order : orderInput; |
8200 var value = orderInput === null ? order : orderInput; |
8140 })])(PageAttributesOrderWithChecks)); |
8234 })])(PageAttributesOrderWithChecks)); |
8141 |
8235 |
8142 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js |
8236 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js |
8143 |
8237 |
8144 |
8238 |
8239 function terms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
8240 |
|
8241 function terms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { terms_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { terms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
8242 |
|
8145 /** |
8243 /** |
8146 * External dependencies |
8244 * External dependencies |
8147 */ |
8245 */ |
8148 |
8246 |
8149 /** |
8247 /** |
8154 * @return {Array} Array of terms in tree format. |
8252 * @return {Array} Array of terms in tree format. |
8155 */ |
8253 */ |
8156 |
8254 |
8157 function buildTermsTree(flatTerms) { |
8255 function buildTermsTree(flatTerms) { |
8158 var flatTermsWithParentAndChildren = flatTerms.map(function (term) { |
8256 var flatTermsWithParentAndChildren = flatTerms.map(function (term) { |
8159 return Object(objectSpread["a" /* default */])({ |
8257 return terms_objectSpread({ |
8160 children: [], |
8258 children: [], |
8161 parent: null |
8259 parent: null |
8162 }, term); |
8260 }, term); |
8163 }); |
8261 }); |
8164 var termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent'); |
8262 var termsByParent = Object(external_this_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent'); |
8165 |
8263 |
8166 if (termsByParent.null && termsByParent.null.length) { |
8264 if (termsByParent.null && termsByParent.null.length) { |
8167 return flatTermsWithParentAndChildren; |
8265 return flatTermsWithParentAndChildren; |
8168 } |
8266 } |
8169 |
8267 |
8170 var fillWithChildren = function fillWithChildren(terms) { |
8268 var fillWithChildren = function fillWithChildren(terms) { |
8171 return terms.map(function (term) { |
8269 return terms.map(function (term) { |
8172 var children = termsByParent[term.id]; |
8270 var children = termsByParent[term.id]; |
8173 return Object(objectSpread["a" /* default */])({}, term, { |
8271 return terms_objectSpread({}, term, { |
8174 children: children && children.length ? fillWithChildren(children) : [] |
8272 children: children && children.length ? fillWithChildren(children) : [] |
8175 }); |
8273 }); |
8176 }); |
8274 }); |
8177 }; |
8275 }; |
8178 |
8276 |
8202 function PageAttributesParent(_ref) { |
8300 function PageAttributesParent(_ref) { |
8203 var parent = _ref.parent, |
8301 var parent = _ref.parent, |
8204 postType = _ref.postType, |
8302 postType = _ref.postType, |
8205 items = _ref.items, |
8303 items = _ref.items, |
8206 onUpdateParent = _ref.onUpdateParent; |
8304 onUpdateParent = _ref.onUpdateParent; |
8207 var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); |
8305 var isHierarchical = Object(external_this_lodash_["get"])(postType, ['hierarchical'], false); |
8208 var parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']); |
8306 var parentPageLabel = Object(external_this_lodash_["get"])(postType, ['labels', 'parent_item_colon']); |
8209 var pageItems = items || []; |
8307 var pageItems = items || []; |
8210 |
8308 |
8211 if (!isHierarchical || !parentPageLabel || !pageItems.length) { |
8309 if (!isHierarchical || !parentPageLabel || !pageItems.length) { |
8212 return null; |
8310 return null; |
8213 } |
8311 } |
8214 |
8312 |
8215 var pagesTree = buildTermsTree(pageItems.map(function (item) { |
8313 var pagesTree = buildTermsTree(pageItems.map(function (item) { |
8216 return { |
8314 return { |
8217 id: item.id, |
8315 id: item.id, |
8218 parent: item.parent, |
8316 parent: item.parent, |
8219 name: item.title.raw ? item.title.raw : "#".concat(item.id, " (").concat(Object(external_this_wp_i18n_["__"])('no title'), ")") |
8317 name: item.title && item.title.raw ? item.title.raw : "#".concat(item.id, " (").concat(Object(external_this_wp_i18n_["__"])('no title'), ")") |
8220 }; |
8318 }; |
8221 })); |
8319 })); |
8222 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], { |
8320 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], { |
8223 className: "editor-page-attributes__parent", |
8321 className: "editor-page-attributes__parent", |
8224 label: parentPageLabel, |
8322 label: parentPageLabel, |
8238 getEditedPostAttribute = _select2.getEditedPostAttribute; |
8336 getEditedPostAttribute = _select2.getEditedPostAttribute; |
8239 |
8337 |
8240 var postTypeSlug = getEditedPostAttribute('type'); |
8338 var postTypeSlug = getEditedPostAttribute('type'); |
8241 var postType = getPostType(postTypeSlug); |
8339 var postType = getPostType(postTypeSlug); |
8242 var postId = getCurrentPostId(); |
8340 var postId = getCurrentPostId(); |
8243 var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); |
8341 var isHierarchical = Object(external_this_lodash_["get"])(postType, ['hierarchical'], false); |
8244 var query = { |
8342 var query = { |
8245 per_page: -1, |
8343 per_page: -1, |
8246 exclude: postId, |
8344 exclude: postId, |
8247 parent_exclude: postId, |
8345 parent_exclude: postId, |
8248 orderby: 'menu_order', |
8346 orderby: 'menu_order', |
8286 function PageTemplate(_ref) { |
8384 function PageTemplate(_ref) { |
8287 var availableTemplates = _ref.availableTemplates, |
8385 var availableTemplates = _ref.availableTemplates, |
8288 selectedTemplate = _ref.selectedTemplate, |
8386 selectedTemplate = _ref.selectedTemplate, |
8289 onUpdate = _ref.onUpdate; |
8387 onUpdate = _ref.onUpdate; |
8290 |
8388 |
8291 if (Object(external_lodash_["isEmpty"])(availableTemplates)) { |
8389 if (Object(external_this_lodash_["isEmpty"])(availableTemplates)) { |
8292 return null; |
8390 return null; |
8293 } |
8391 } |
8294 |
8392 |
8295 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { |
8393 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { |
8296 label: Object(external_this_wp_i18n_["__"])('Template:'), |
8394 label: Object(external_this_wp_i18n_["__"])('Template:'), |
8297 value: selectedTemplate, |
8395 value: selectedTemplate, |
8298 onChange: onUpdate, |
8396 onChange: onUpdate, |
8299 className: "editor-page-attributes__template", |
8397 className: "editor-page-attributes__template", |
8300 options: Object(external_lodash_["map"])(availableTemplates, function (templateName, templateSlug) { |
8398 options: Object(external_this_lodash_["map"])(availableTemplates, function (templateName, templateSlug) { |
8301 return { |
8399 return { |
8302 value: templateSlug, |
8400 value: templateSlug, |
8303 label: templateName |
8401 label: templateName |
8304 }; |
8402 }; |
8305 }) |
8403 }) |
8325 }); |
8423 }); |
8326 } |
8424 } |
8327 }; |
8425 }; |
8328 }))(PageTemplate)); |
8426 }))(PageTemplate)); |
8329 |
8427 |
8428 // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} |
|
8429 var external_this_wp_htmlEntities_ = __webpack_require__(75); |
|
8430 |
|
8330 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js |
8431 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js |
8331 |
8432 |
8332 |
8433 |
8333 /** |
8434 /** |
8334 * External dependencies |
8435 * External dependencies |
8359 }, children); |
8460 }, children); |
8360 } |
8461 } |
8361 /* harmony default export */ var post_author_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
8462 /* harmony default export */ var post_author_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
8362 var post = select('core/editor').getCurrentPost(); |
8463 var post = select('core/editor').getCurrentPost(); |
8363 return { |
8464 return { |
8364 hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false), |
8465 hasAssignAuthorAction: Object(external_this_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false), |
8365 postType: select('core/editor').getCurrentPostType(), |
8466 postType: select('core/editor').getCurrentPostType(), |
8366 authors: select('core').getAuthors() |
8467 authors: select('core').getAuthors() |
8367 }; |
8468 }; |
8368 }), external_this_wp_compose_["withInstanceId"]])(PostAuthorCheck)); |
8469 }), external_this_wp_compose_["withInstanceId"]])(PostAuthorCheck)); |
8369 |
8470 |
8374 |
8475 |
8375 |
8476 |
8376 |
8477 |
8377 |
8478 |
8378 |
8479 |
8480 function post_author_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_author_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
8481 |
|
8482 function post_author_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
8483 |
|
8379 /** |
8484 /** |
8380 * WordPress dependencies |
8485 * WordPress dependencies |
8381 */ |
8486 */ |
8382 |
8487 |
8383 |
8488 |
8384 |
8489 |
8385 |
8490 |
8491 |
|
8386 /** |
8492 /** |
8387 * Internal dependencies |
8493 * Internal dependencies |
8388 */ |
8494 */ |
8389 |
8495 |
8390 |
8496 |
8391 var post_author_PostAuthor = |
8497 var post_author_PostAuthor = /*#__PURE__*/function (_Component) { |
8392 /*#__PURE__*/ |
|
8393 function (_Component) { |
|
8394 Object(inherits["a" /* default */])(PostAuthor, _Component); |
8498 Object(inherits["a" /* default */])(PostAuthor, _Component); |
8499 |
|
8500 var _super = post_author_createSuper(PostAuthor); |
|
8395 |
8501 |
8396 function PostAuthor() { |
8502 function PostAuthor() { |
8397 var _this; |
8503 var _this; |
8398 |
8504 |
8399 Object(classCallCheck["a" /* default */])(this, PostAuthor); |
8505 Object(classCallCheck["a" /* default */])(this, PostAuthor); |
8400 |
8506 |
8401 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostAuthor).apply(this, arguments)); |
8507 _this = _super.apply(this, arguments); |
8402 _this.setAuthorId = _this.setAuthorId.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
8508 _this.setAuthorId = _this.setAuthorId.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
8403 return _this; |
8509 return _this; |
8404 } |
8510 } |
8405 |
8511 |
8406 Object(createClass["a" /* default */])(PostAuthor, [{ |
8512 Object(createClass["a" /* default */])(PostAuthor, [{ |
8407 key: "setAuthorId", |
8513 key: "setAuthorId", |
8430 className: "editor-post-author__select" |
8536 className: "editor-post-author__select" |
8431 }, authors.map(function (author) { |
8537 }, authors.map(function (author) { |
8432 return Object(external_this_wp_element_["createElement"])("option", { |
8538 return Object(external_this_wp_element_["createElement"])("option", { |
8433 key: author.id, |
8539 key: author.id, |
8434 value: author.id |
8540 value: author.id |
8435 }, author.name); |
8541 }, Object(external_this_wp_htmlEntities_["decodeEntities"])(author.name)); |
8436 }))); |
8542 }))); |
8437 /* eslint-enable jsx-a11y/no-onchange */ |
8543 /* eslint-enable jsx-a11y/no-onchange */ |
8438 } |
8544 } |
8439 }]); |
8545 }]); |
8440 |
8546 |
8477 comment_status: commentStatus === 'open' ? 'closed' : 'open' |
8583 comment_status: commentStatus === 'open' ? 'closed' : 'open' |
8478 }); |
8584 }); |
8479 }; |
8585 }; |
8480 |
8586 |
8481 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
8587 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
8482 label: Object(external_this_wp_i18n_["__"])('Allow Comments'), |
8588 label: Object(external_this_wp_i18n_["__"])('Allow comments'), |
8483 checked: commentStatus === 'open', |
8589 checked: commentStatus === 'open', |
8484 onChange: onToggleComments |
8590 onChange: onToggleComments |
8485 }); |
8591 }); |
8486 } |
8592 } |
8487 |
8593 |
8517 onChange: function onChange(value) { |
8623 onChange: function onChange(value) { |
8518 return onUpdateExcerpt(value); |
8624 return onUpdateExcerpt(value); |
8519 }, |
8625 }, |
8520 value: excerpt |
8626 value: excerpt |
8521 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { |
8627 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { |
8522 href: Object(external_this_wp_i18n_["__"])('https://codex.wordpress.org/Excerpt') |
8628 href: Object(external_this_wp_i18n_["__"])('https://wordpress.org/support/article/excerpt/') |
8523 }, Object(external_this_wp_i18n_["__"])('Learn more about manual excerpts'))); |
8629 }, Object(external_this_wp_i18n_["__"])('Learn more about manual excerpts'))); |
8524 } |
8630 } |
8525 |
8631 |
8526 /* harmony default export */ var post_excerpt = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
8632 /* harmony default export */ var post_excerpt = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
8527 return { |
8633 return { |
8567 function ThemeSupportCheck(_ref) { |
8673 function ThemeSupportCheck(_ref) { |
8568 var themeSupports = _ref.themeSupports, |
8674 var themeSupports = _ref.themeSupports, |
8569 children = _ref.children, |
8675 children = _ref.children, |
8570 postType = _ref.postType, |
8676 postType = _ref.postType, |
8571 supportKeys = _ref.supportKeys; |
8677 supportKeys = _ref.supportKeys; |
8572 var isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) { |
8678 var isSupported = Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(supportKeys), function (key) { |
8573 var supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. |
8679 var supported = Object(external_this_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. |
8574 // In the latter case, we need to verify `postType` exists |
8680 // In the latter case, we need to verify `postType` exists |
8575 // within `supported`. If `postType` isn't passed, then the check |
8681 // within `supported`. If `postType` isn't passed, then the check |
8576 // should fail. |
8682 // should fail. |
8577 |
8683 |
8578 if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) { |
8684 if ('post-thumbnails' === key && Object(external_this_lodash_["isArray"])(supported)) { |
8579 return Object(external_lodash_["includes"])(supported, postType); |
8685 return Object(external_this_lodash_["includes"])(supported, postType); |
8580 } |
8686 } |
8581 |
8687 |
8582 return supported; |
8688 return supported; |
8583 }); |
8689 }); |
8584 |
8690 |
8622 /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); |
8728 /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); |
8623 |
8729 |
8624 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js |
8730 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js |
8625 |
8731 |
8626 |
8732 |
8733 |
|
8627 /** |
8734 /** |
8628 * External dependencies |
8735 * External dependencies |
8629 */ |
8736 */ |
8630 |
8737 |
8631 /** |
8738 /** |
8643 */ |
8750 */ |
8644 |
8751 |
8645 |
8752 |
8646 var ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. |
8753 var ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. |
8647 |
8754 |
8648 var DEFAULT_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Featured Image'); |
8755 var DEFAULT_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Featured image'); |
8649 |
8756 |
8650 var DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Set featured image'); |
8757 var DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Set featured image'); |
8651 |
8758 |
8652 var DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Remove image'); |
8759 var DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Remove image'); |
8653 |
8760 |
8654 function PostFeaturedImage(_ref) { |
8761 function PostFeaturedImage(_ref) { |
8655 var currentPostId = _ref.currentPostId, |
8762 var currentPostId = _ref.currentPostId, |
8656 featuredImageId = _ref.featuredImageId, |
8763 featuredImageId = _ref.featuredImageId, |
8657 onUpdateImage = _ref.onUpdateImage, |
8764 onUpdateImage = _ref.onUpdateImage, |
8765 onDropImage = _ref.onDropImage, |
|
8658 onRemoveImage = _ref.onRemoveImage, |
8766 onRemoveImage = _ref.onRemoveImage, |
8659 media = _ref.media, |
8767 media = _ref.media, |
8660 postType = _ref.postType; |
8768 postType = _ref.postType, |
8661 var postLabel = Object(external_lodash_["get"])(postType, ['labels'], {}); |
8769 noticeUI = _ref.noticeUI; |
8770 var postLabel = Object(external_this_lodash_["get"])(postType, ['labels'], {}); |
|
8662 var instructions = Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.')); |
8771 var instructions = Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.')); |
8663 var mediaWidth, mediaHeight, mediaSourceUrl; |
8772 var mediaWidth, mediaHeight, mediaSourceUrl; |
8664 |
8773 |
8665 if (media) { |
8774 if (media) { |
8666 var mediaSize = Object(external_this_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); |
8775 var mediaSize = Object(external_this_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); |
8667 |
8776 |
8668 if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) { |
8777 if (Object(external_this_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) { |
8778 // use mediaSize when available |
|
8669 mediaWidth = media.media_details.sizes[mediaSize].width; |
8779 mediaWidth = media.media_details.sizes[mediaSize].width; |
8670 mediaHeight = media.media_details.sizes[mediaSize].height; |
8780 mediaHeight = media.media_details.sizes[mediaSize].height; |
8671 mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; |
8781 mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; |
8672 } else { |
8782 } else { |
8673 mediaWidth = media.media_details.width; |
8783 // get fallbackMediaSize if mediaSize is not available |
8674 mediaHeight = media.media_details.height; |
8784 var fallbackMediaSize = Object(external_this_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId); |
8675 mediaSourceUrl = media.source_url; |
8785 |
8786 if (Object(external_this_lodash_["has"])(media, ['media_details', 'sizes', fallbackMediaSize])) { |
|
8787 // use fallbackMediaSize when mediaSize is not available |
|
8788 mediaWidth = media.media_details.sizes[fallbackMediaSize].width; |
|
8789 mediaHeight = media.media_details.sizes[fallbackMediaSize].height; |
|
8790 mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url; |
|
8791 } else { |
|
8792 // use full image size when mediaFallbackSize and mediaSize are not available |
|
8793 mediaWidth = media.media_details.width; |
|
8794 mediaHeight = media.media_details.height; |
|
8795 mediaSourceUrl = media.source_url; |
|
8796 } |
|
8676 } |
8797 } |
8677 } |
8798 } |
8678 |
8799 |
8679 return Object(external_this_wp_element_["createElement"])(post_featured_image_check, null, Object(external_this_wp_element_["createElement"])("div", { |
8800 return Object(external_this_wp_element_["createElement"])(post_featured_image_check, null, noticeUI, Object(external_this_wp_element_["createElement"])("div", { |
8680 className: "editor-post-featured-image" |
8801 className: "editor-post-featured-image" |
8681 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], { |
8802 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], { |
8682 fallback: instructions |
8803 fallback: instructions |
8683 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { |
8804 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { |
8684 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
8805 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
8685 onSelect: onUpdateImage, |
8806 onSelect: onUpdateImage, |
8807 unstableFeaturedImageFlow: true, |
|
8686 allowedTypes: ALLOWED_MEDIA_TYPES, |
8808 allowedTypes: ALLOWED_MEDIA_TYPES, |
8687 modalClass: !featuredImageId ? 'editor-post-featured-image__media-modal' : 'editor-post-featured-image__media-modal', |
8809 modalClass: !featuredImageId ? 'editor-post-featured-image__media-modal' : 'editor-post-featured-image__media-modal', |
8688 render: function render(_ref2) { |
8810 render: function render(_ref2) { |
8689 var open = _ref2.open; |
8811 var open = _ref2.open; |
8690 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
8812 return Object(external_this_wp_element_["createElement"])("div", { |
8813 className: "editor-post-featured-image__container" |
|
8814 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
8691 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', |
8815 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', |
8692 onClick: open, |
8816 onClick: open, |
8693 "aria-label": !featuredImageId ? null : Object(external_this_wp_i18n_["__"])('Edit or update the image') |
8817 "aria-label": !featuredImageId ? null : Object(external_this_wp_i18n_["__"])('Edit or update the image') |
8694 }, !!featuredImageId && media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResponsiveWrapper"], { |
8818 }, !!featuredImageId && media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResponsiveWrapper"], { |
8695 naturalWidth: mediaWidth, |
8819 naturalWidth: mediaWidth, |
8696 naturalHeight: mediaHeight |
8820 naturalHeight: mediaHeight, |
8821 isInline: true |
|
8697 }, Object(external_this_wp_element_["createElement"])("img", { |
8822 }, Object(external_this_wp_element_["createElement"])("img", { |
8698 src: mediaSourceUrl, |
8823 src: mediaSourceUrl, |
8699 alt: "" |
8824 alt: "" |
8700 })), !!featuredImageId && !media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)); |
8825 })), !!featuredImageId && !media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DropZone"], { |
8826 onFilesDrop: onDropImage |
|
8827 })); |
|
8701 }, |
8828 }, |
8702 value: featuredImageId |
8829 value: featuredImageId |
8703 })), !!featuredImageId && media && !media.isLoading && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { |
8830 })), !!featuredImageId && media && !media.isLoading && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { |
8704 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
8831 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
8705 onSelect: onUpdateImage, |
8832 onSelect: onUpdateImage, |
8833 unstableFeaturedImageFlow: true, |
|
8706 allowedTypes: ALLOWED_MEDIA_TYPES, |
8834 allowedTypes: ALLOWED_MEDIA_TYPES, |
8707 modalClass: "editor-post-featured-image__media-modal", |
8835 modalClass: "editor-post-featured-image__media-modal", |
8708 render: function render(_ref3) { |
8836 render: function render(_ref3) { |
8709 var open = _ref3.open; |
8837 var open = _ref3.open; |
8710 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
8838 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
8711 onClick: open, |
8839 onClick: open, |
8712 isDefault: true, |
8840 isSecondary: true |
8713 isLarge: true |
8841 }, Object(external_this_wp_i18n_["__"])('Replace Image')); |
8714 }, Object(external_this_wp_i18n_["__"])('Replace image')); |
|
8715 } |
8842 } |
8716 })), !!featuredImageId && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
8843 })), !!featuredImageId && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
8717 onClick: onRemoveImage, |
8844 onClick: onRemoveImage, |
8718 isLink: true, |
8845 isLink: true, |
8719 isDestructive: true |
8846 isDestructive: true |
8735 currentPostId: getCurrentPostId(), |
8862 currentPostId: getCurrentPostId(), |
8736 postType: getPostType(getEditedPostAttribute('type')), |
8863 postType: getPostType(getEditedPostAttribute('type')), |
8737 featuredImageId: featuredImageId |
8864 featuredImageId: featuredImageId |
8738 }; |
8865 }; |
8739 }); |
8866 }); |
8740 var post_featured_image_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
8867 var post_featured_image_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref4, _ref5) { |
8868 var noticeOperations = _ref4.noticeOperations; |
|
8869 var select = _ref5.select; |
|
8870 |
|
8741 var _dispatch = dispatch('core/editor'), |
8871 var _dispatch = dispatch('core/editor'), |
8742 editPost = _dispatch.editPost; |
8872 editPost = _dispatch.editPost; |
8743 |
8873 |
8744 return { |
8874 return { |
8745 onUpdateImage: function onUpdateImage(image) { |
8875 onUpdateImage: function onUpdateImage(image) { |
8746 editPost({ |
8876 editPost({ |
8747 featured_media: image.id |
8877 featured_media: image.id |
8748 }); |
8878 }); |
8749 }, |
8879 }, |
8880 onDropImage: function onDropImage(filesList) { |
|
8881 select('core/block-editor').getSettings().mediaUpload({ |
|
8882 allowedTypes: ['image'], |
|
8883 filesList: filesList, |
|
8884 onFileChange: function onFileChange(_ref6) { |
|
8885 var _ref7 = Object(slicedToArray["a" /* default */])(_ref6, 1), |
|
8886 image = _ref7[0]; |
|
8887 |
|
8888 editPost({ |
|
8889 featured_media: image.id |
|
8890 }); |
|
8891 }, |
|
8892 onError: function onError(message) { |
|
8893 noticeOperations.removeAllNotices(); |
|
8894 noticeOperations.createErrorNotice(message); |
|
8895 } |
|
8896 }); |
|
8897 }, |
|
8750 onRemoveImage: function onRemoveImage() { |
8898 onRemoveImage: function onRemoveImage() { |
8751 editPost({ |
8899 editPost({ |
8752 featured_media: 0 |
8900 featured_media: 0 |
8753 }); |
8901 }); |
8754 } |
8902 } |
8755 }; |
8903 }; |
8756 }); |
8904 }); |
8757 /* harmony default export */ var post_featured_image = (Object(external_this_wp_compose_["compose"])(post_featured_image_applyWithSelect, post_featured_image_applyWithDispatch, Object(external_this_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage)); |
8905 /* harmony default export */ var post_featured_image = (Object(external_this_wp_compose_["compose"])(external_this_wp_components_["withNotices"], post_featured_image_applyWithSelect, post_featured_image_applyWithDispatch, Object(external_this_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage)); |
8758 |
8906 |
8759 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js |
8907 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js |
8760 |
8908 |
8761 |
8909 |
8762 |
8910 |
8846 supportedFormats = _ref.supportedFormats, |
8994 supportedFormats = _ref.supportedFormats, |
8847 suggestedFormat = _ref.suggestedFormat, |
8995 suggestedFormat = _ref.suggestedFormat, |
8848 instanceId = _ref.instanceId; |
8996 instanceId = _ref.instanceId; |
8849 var postFormatSelectorId = 'post-format-selector-' + instanceId; |
8997 var postFormatSelectorId = 'post-format-selector-' + instanceId; |
8850 var formats = POST_FORMATS.filter(function (format) { |
8998 var formats = POST_FORMATS.filter(function (format) { |
8851 return Object(external_lodash_["includes"])(supportedFormats, format.id); |
8999 return Object(external_this_lodash_["includes"])(supportedFormats, format.id); |
8852 }); |
9000 }); |
8853 var suggestion = Object(external_lodash_["find"])(formats, function (format) { |
9001 var suggestion = Object(external_this_lodash_["find"])(formats, function (format) { |
8854 return format.id === suggestedFormat; |
9002 return format.id === suggestedFormat; |
8855 }); // Disable reason: We need to change the value immiediately to show/hide the suggestion if needed |
9003 }); // Disable reason: We need to change the value immiediately to show/hide the suggestion if needed |
8856 |
|
8857 /* eslint-disable jsx-a11y/no-onchange */ |
|
8858 |
9004 |
8859 return Object(external_this_wp_element_["createElement"])(post_format_check, null, Object(external_this_wp_element_["createElement"])("div", { |
9005 return Object(external_this_wp_element_["createElement"])(post_format_check, null, Object(external_this_wp_element_["createElement"])("div", { |
8860 className: "editor-post-format" |
9006 className: "editor-post-format" |
8861 }, Object(external_this_wp_element_["createElement"])("div", { |
9007 }, Object(external_this_wp_element_["createElement"])("div", { |
8862 className: "editor-post-format__content" |
9008 className: "editor-post-format__content" |
8880 isLink: true, |
9026 isLink: true, |
8881 onClick: function onClick() { |
9027 onClick: function onClick() { |
8882 return onUpdatePostFormat(suggestion.id); |
9028 return onUpdatePostFormat(suggestion.id); |
8883 } |
9029 } |
8884 }, suggestion.caption)))); |
9030 }, suggestion.caption)))); |
8885 /* eslint-enable jsx-a11y/no-onchange */ |
|
8886 } |
9031 } |
8887 |
9032 |
8888 /* harmony default export */ var post_format = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
9033 /* harmony default export */ var post_format = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
8889 var _select = select('core/editor'), |
9034 var _select = select('core/editor'), |
8890 getEditedPostAttribute = _select.getEditedPostAttribute, |
9035 getEditedPostAttribute = _select.getEditedPostAttribute, |
8892 |
9037 |
8893 var postFormat = getEditedPostAttribute('format'); |
9038 var postFormat = getEditedPostAttribute('format'); |
8894 var themeSupports = select('core').getThemeSupports(); // Ensure current format is always in the set. |
9039 var themeSupports = select('core').getThemeSupports(); // Ensure current format is always in the set. |
8895 // The current format may not be a format supported by the theme. |
9040 // The current format may not be a format supported by the theme. |
8896 |
9041 |
8897 var supportedFormats = Object(external_lodash_["union"])([postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], [])); |
9042 var supportedFormats = Object(external_this_lodash_["union"])([postFormat], Object(external_this_lodash_["get"])(themeSupports, ['formats'], [])); |
8898 return { |
9043 return { |
8899 postFormat: postFormat, |
9044 postFormat: postFormat, |
8900 supportedFormats: supportedFormats, |
9045 supportedFormats: supportedFormats, |
8901 suggestedFormat: getSuggestedPostFormat() |
9046 suggestedFormat: getSuggestedPostFormat() |
8902 }; |
9047 }; |
8908 }); |
9053 }); |
8909 } |
9054 } |
8910 }; |
9055 }; |
8911 }), external_this_wp_compose_["withInstanceId"]])(PostFormat)); |
9056 }), external_this_wp_compose_["withInstanceId"]])(PostFormat)); |
8912 |
9057 |
9058 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js |
|
9059 |
|
9060 |
|
9061 /** |
|
9062 * WordPress dependencies |
|
9063 */ |
|
9064 |
|
9065 var backup = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
9066 xmlns: "http://www.w3.org/2000/svg", |
|
9067 viewBox: "-2 -2 24 24" |
|
9068 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
9069 d: "M13.65 2.88c3.93 2.01 5.48 6.84 3.47 10.77s-6.83 5.48-10.77 3.47c-1.87-.96-3.2-2.56-3.86-4.4l1.64-1.03c.45 1.57 1.52 2.95 3.08 3.76 3.01 1.54 6.69.35 8.23-2.66 1.55-3.01.36-6.69-2.65-8.24C9.78 3.01 6.1 4.2 4.56 7.21l1.88.97-4.95 3.08-.39-5.82 1.78.91C4.9 2.4 9.75.89 13.65 2.88zm-4.36 7.83C9.11 10.53 9 10.28 9 10c0-.07.03-.12.04-.19h-.01L10 5l.97 4.81L14 13l-4.5-2.12.02-.02c-.08-.04-.16-.09-.23-.15z" |
|
9070 })); |
|
9071 /* harmony default export */ var library_backup = (backup); |
|
9072 |
|
8913 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js |
9073 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js |
8914 |
9074 |
8915 |
9075 |
8916 /** |
9076 /** |
8917 * WordPress dependencies |
9077 * WordPress dependencies |
8944 lastRevisionId: getCurrentPostLastRevisionId(), |
9104 lastRevisionId: getCurrentPostLastRevisionId(), |
8945 revisionsCount: getCurrentPostRevisionsCount() |
9105 revisionsCount: getCurrentPostRevisionsCount() |
8946 }; |
9106 }; |
8947 })(PostLastRevisionCheck)); |
9107 })(PostLastRevisionCheck)); |
8948 |
9108 |
8949 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js |
9109 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js |
8950 /** |
9110 |
8951 * External dependencies |
|
8952 */ |
|
8953 |
9111 |
8954 /** |
9112 /** |
8955 * WordPress dependencies |
9113 * WordPress dependencies |
8956 */ |
9114 */ |
8957 |
9115 |
8958 |
|
8959 /** |
|
8960 * Returns the URL of a WPAdmin Page. |
|
8961 * |
|
8962 * TODO: This should be moved to a module less specific to the editor. |
|
8963 * |
|
8964 * @param {string} page Page to navigate to. |
|
8965 * @param {Object} query Query Args. |
|
8966 * |
|
8967 * @return {string} WPAdmin URL. |
|
8968 */ |
|
8969 |
|
8970 function getWPAdminURL(page, query) { |
|
8971 return Object(external_this_wp_url_["addQueryArgs"])(page, query); |
|
8972 } |
|
8973 /** |
|
8974 * Performs some basic cleanup of a string for use as a post slug |
|
8975 * |
|
8976 * This replicates some of what santize_title() does in WordPress core, but |
|
8977 * is only designed to approximate what the slug will be. |
|
8978 * |
|
8979 * Converts whitespace, periods, forward slashes and underscores to hyphens. |
|
8980 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin |
|
8981 * letters. Removes combining diacritical marks. Converts remaining string |
|
8982 * to lowercase. It does not touch octets, HTML entities, or other encoded |
|
8983 * characters. |
|
8984 * |
|
8985 * @param {string} string Title or slug to be processed |
|
8986 * |
|
8987 * @return {string} Processed string |
|
8988 */ |
|
8989 |
|
8990 function cleanForSlug(string) { |
|
8991 return Object(external_lodash_["toLower"])(Object(external_lodash_["deburr"])(Object(external_lodash_["trim"])(string.replace(/[\s\./_]+/g, '-'), '-'))); |
|
8992 } |
|
8993 |
|
8994 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js |
|
8995 |
|
8996 |
|
8997 /** |
|
8998 * WordPress dependencies |
|
8999 */ |
|
9000 |
9116 |
9001 |
9117 |
9002 |
9118 |
9003 /** |
9119 /** |
9004 * Internal dependencies |
9120 * Internal dependencies |
9008 |
9124 |
9009 |
9125 |
9010 function LastRevision(_ref) { |
9126 function LastRevision(_ref) { |
9011 var lastRevisionId = _ref.lastRevisionId, |
9127 var lastRevisionId = _ref.lastRevisionId, |
9012 revisionsCount = _ref.revisionsCount; |
9128 revisionsCount = _ref.revisionsCount; |
9013 return Object(external_this_wp_element_["createElement"])(post_last_revision_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
9129 return Object(external_this_wp_element_["createElement"])(post_last_revision_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9014 href: getWPAdminURL('revision.php', { |
9130 href: getWPAdminURL('revision.php', { |
9015 revision: lastRevisionId, |
9131 revision: lastRevisionId, |
9016 gutenberg: true |
9132 gutenberg: true |
9017 }), |
9133 }), |
9018 className: "editor-post-last-revision__title", |
9134 className: "editor-post-last-revision__title", |
9019 icon: "backup" |
9135 icon: library_backup |
9020 }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); |
9136 }, Object(external_this_wp_i18n_["sprintf"])( |
9137 /* translators: %d: number of revisions */ |
|
9138 Object(external_this_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); |
|
9021 } |
9139 } |
9022 |
9140 |
9023 /* harmony default export */ var post_last_revision = (Object(external_this_wp_data_["withSelect"])(function (select) { |
9141 /* harmony default export */ var post_last_revision = (Object(external_this_wp_data_["withSelect"])(function (select) { |
9024 var _select = select('core/editor'), |
9142 var _select = select('core/editor'), |
9025 getCurrentPostLastRevisionId = _select.getCurrentPostLastRevisionId, |
9143 getCurrentPostLastRevisionId = _select.getCurrentPostLastRevisionId, |
9038 |
9156 |
9039 |
9157 |
9040 |
9158 |
9041 |
9159 |
9042 |
9160 |
9161 function post_preview_button_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_preview_button_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
9162 |
|
9163 function post_preview_button_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
9164 |
|
9043 /** |
9165 /** |
9044 * External dependencies |
9166 * External dependencies |
9045 */ |
9167 */ |
9046 |
9168 |
9169 |
|
9047 /** |
9170 /** |
9048 * WordPress dependencies |
9171 * WordPress dependencies |
9049 */ |
9172 */ |
9050 |
|
9051 |
9173 |
9052 |
9174 |
9053 |
9175 |
9054 |
9176 |
9055 |
9177 |
9073 })), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Generating preview…')))); |
9195 })), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Generating preview…')))); |
9074 markup += "\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t"; |
9196 markup += "\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t"; |
9075 /** |
9197 /** |
9076 * Filters the interstitial message shown when generating previews. |
9198 * Filters the interstitial message shown when generating previews. |
9077 * |
9199 * |
9078 * @param {String} markup The preview interstitial markup. |
9200 * @param {string} markup The preview interstitial markup. |
9079 */ |
9201 */ |
9080 |
9202 |
9081 markup = Object(external_this_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup); |
9203 markup = Object(external_this_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup); |
9082 targetDocument.write(markup); |
9204 targetDocument.write(markup); |
9083 targetDocument.title = Object(external_this_wp_i18n_["__"])('Generating preview…'); |
9205 targetDocument.title = Object(external_this_wp_i18n_["__"])('Generating preview…'); |
9084 targetDocument.close(); |
9206 targetDocument.close(); |
9085 } |
9207 } |
9086 |
9208 |
9087 var post_preview_button_PostPreviewButton = |
9209 var post_preview_button_PostPreviewButton = /*#__PURE__*/function (_Component) { |
9088 /*#__PURE__*/ |
|
9089 function (_Component) { |
|
9090 Object(inherits["a" /* default */])(PostPreviewButton, _Component); |
9210 Object(inherits["a" /* default */])(PostPreviewButton, _Component); |
9211 |
|
9212 var _super = post_preview_button_createSuper(PostPreviewButton); |
|
9091 |
9213 |
9092 function PostPreviewButton() { |
9214 function PostPreviewButton() { |
9093 var _this; |
9215 var _this; |
9094 |
9216 |
9095 Object(classCallCheck["a" /* default */])(this, PostPreviewButton); |
9217 Object(classCallCheck["a" /* default */])(this, PostPreviewButton); |
9096 |
9218 |
9097 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPreviewButton).apply(this, arguments)); |
9219 _this = _super.apply(this, arguments); |
9098 _this.openPreviewWindow = _this.openPreviewWindow.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
9220 _this.buttonRef = Object(external_this_wp_element_["createRef"])(); |
9221 _this.openPreviewWindow = _this.openPreviewWindow.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
9099 return _this; |
9222 return _this; |
9100 } |
9223 } |
9101 |
9224 |
9102 Object(createClass["a" /* default */])(PostPreviewButton, [{ |
9225 Object(createClass["a" /* default */])(PostPreviewButton, [{ |
9103 key: "componentDidUpdate", |
9226 key: "componentDidUpdate", |
9122 value: function setPreviewWindowLink(url) { |
9245 value: function setPreviewWindowLink(url) { |
9123 var previewWindow = this.previewWindow; |
9246 var previewWindow = this.previewWindow; |
9124 |
9247 |
9125 if (previewWindow && !previewWindow.closed) { |
9248 if (previewWindow && !previewWindow.closed) { |
9126 previewWindow.location = url; |
9249 previewWindow.location = url; |
9250 |
|
9251 if (this.buttonRef.current) { |
|
9252 this.buttonRef.current.focus(); |
|
9253 } |
|
9127 } |
9254 } |
9128 } |
9255 } |
9129 }, { |
9256 }, { |
9130 key: "getWindowTarget", |
9257 key: "getWindowTarget", |
9131 value: function getWindowTarget() { |
9258 value: function getWindowTarget() { |
9182 isSaveable = _this$props.isSaveable; // Link to the `?preview=true` URL if we have it, since this lets us see |
9309 isSaveable = _this$props.isSaveable; // Link to the `?preview=true` URL if we have it, since this lets us see |
9183 // changes that were autosaved since the post was last published. Otherwise, |
9310 // changes that were autosaved since the post was last published. Otherwise, |
9184 // just link to the post's URL. |
9311 // just link to the post's URL. |
9185 |
9312 |
9186 var href = previewLink || currentPostLink; |
9313 var href = previewLink || currentPostLink; |
9314 var classNames = classnames_default()({ |
|
9315 'editor-post-preview': !this.props.className |
|
9316 }, this.props.className); |
|
9187 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9317 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9188 isLarge: true, |
9318 isTertiary: !this.props.className, |
9189 className: "editor-post-preview", |
9319 className: classNames, |
9190 href: href, |
9320 href: href, |
9191 target: this.getWindowTarget(), |
9321 target: this.getWindowTarget(), |
9192 disabled: !isSaveable, |
9322 disabled: !isSaveable, |
9193 onClick: this.openPreviewWindow |
9323 onClick: this.openPreviewWindow, |
9194 }, Object(external_this_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_this_wp_element_["createElement"])("span", { |
9324 ref: this.buttonRef |
9195 className: "screen-reader-text" |
9325 }, this.props.textContent ? this.props.textContent : Object(external_this_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { |
9326 as: "span" |
|
9196 }, |
9327 }, |
9197 /* translators: accessibility text */ |
9328 /* translators: accessibility text */ |
9198 Object(external_this_wp_i18n_["__"])('(opens in a new tab)')), Object(external_this_wp_element_["createElement"])(external_this_wp_nux_["DotTip"], { |
9329 Object(external_this_wp_i18n_["__"])('(opens in a new tab)'))); |
9199 tipId: "core/editor.preview" |
|
9200 }, Object(external_this_wp_i18n_["__"])('Click “Preview” to load a preview of this page, so you can make sure you’re happy with your blocks.'))); |
|
9201 } |
9330 } |
9202 }]); |
9331 }]); |
9203 |
9332 |
9204 return PostPreviewButton; |
9333 return PostPreviewButton; |
9205 }(external_this_wp_element_["Component"]); |
9334 }(external_this_wp_element_["Component"]); |
9224 postId: getCurrentPostId(), |
9353 postId: getCurrentPostId(), |
9225 currentPostLink: getCurrentPostAttribute('link'), |
9354 currentPostLink: getCurrentPostAttribute('link'), |
9226 previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, |
9355 previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, |
9227 isSaveable: isEditedPostSaveable(), |
9356 isSaveable: isEditedPostSaveable(), |
9228 isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), |
9357 isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), |
9229 isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), |
9358 isViewable: Object(external_this_lodash_["get"])(postType, ['viewable'], false), |
9230 isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1 |
9359 isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1 |
9231 }; |
9360 }; |
9232 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
9361 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
9233 return { |
9362 return { |
9234 autosave: dispatch('core/editor').autosave, |
9363 autosave: dispatch('core/editor').autosave, |
9246 |
9375 |
9247 |
9376 |
9248 |
9377 |
9249 |
9378 |
9250 |
9379 |
9380 function post_locked_modal_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_locked_modal_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
9381 |
|
9382 function post_locked_modal_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
9383 |
|
9251 /** |
9384 /** |
9252 * External dependencies |
9385 * External dependencies |
9253 */ |
9386 */ |
9254 |
9387 |
9255 /** |
9388 /** |
9268 */ |
9401 */ |
9269 |
9402 |
9270 |
9403 |
9271 |
9404 |
9272 |
9405 |
9273 var post_locked_modal_PostLockedModal = |
9406 var post_locked_modal_PostLockedModal = /*#__PURE__*/function (_Component) { |
9274 /*#__PURE__*/ |
|
9275 function (_Component) { |
|
9276 Object(inherits["a" /* default */])(PostLockedModal, _Component); |
9407 Object(inherits["a" /* default */])(PostLockedModal, _Component); |
9408 |
|
9409 var _super = post_locked_modal_createSuper(PostLockedModal); |
|
9277 |
9410 |
9278 function PostLockedModal() { |
9411 function PostLockedModal() { |
9279 var _this; |
9412 var _this; |
9280 |
9413 |
9281 Object(classCallCheck["a" /* default */])(this, PostLockedModal); |
9414 Object(classCallCheck["a" /* default */])(this, PostLockedModal); |
9282 |
9415 |
9283 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostLockedModal).apply(this, arguments)); |
9416 _this = _super.apply(this, arguments); |
9284 _this.sendPostLock = _this.sendPostLock.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
9417 _this.sendPostLock = _this.sendPostLock.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9285 _this.receivePostLock = _this.receivePostLock.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
9418 _this.receivePostLock = _this.receivePostLock.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9286 _this.releasePostLock = _this.releasePostLock.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
9419 _this.releasePostLock = _this.releasePostLock.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9287 return _this; |
9420 return _this; |
9288 } |
9421 } |
9289 |
9422 |
9290 Object(createClass["a" /* default */])(PostLockedModal, [{ |
9423 Object(createClass["a" /* default */])(PostLockedModal, [{ |
9291 key: "componentDidMount", |
9424 key: "componentDidMount", |
9397 var data = new window.FormData(); |
9530 var data = new window.FormData(); |
9398 data.append('action', 'wp-remove-post-lock'); |
9531 data.append('action', 'wp-remove-post-lock'); |
9399 data.append('_wpnonce', postLockUtils.unlockNonce); |
9532 data.append('_wpnonce', postLockUtils.unlockNonce); |
9400 data.append('post_ID', postId); |
9533 data.append('post_ID', postId); |
9401 data.append('active_post_lock', activePostLock); |
9534 data.append('active_post_lock', activePostLock); |
9402 var xhr = new window.XMLHttpRequest(); |
9535 |
9403 xhr.open('POST', postLockUtils.ajaxUrl, false); |
9536 if (window.navigator.sendBeacon) { |
9404 xhr.send(data); |
9537 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); |
9538 } else { |
|
9539 var xhr = new window.XMLHttpRequest(); |
|
9540 xhr.open('POST', postLockUtils.ajaxUrl, false); |
|
9541 xhr.send(data); |
|
9542 } |
|
9405 } |
9543 } |
9406 }, { |
9544 }, { |
9407 key: "render", |
9545 key: "render", |
9408 value: function render() { |
9546 value: function render() { |
9409 var _this$props4 = this.props, |
9547 var _this$props4 = this.props, |
9426 post: postId, |
9564 post: postId, |
9427 action: 'edit', |
9565 action: 'edit', |
9428 _wpnonce: postLockUtils.nonce |
9566 _wpnonce: postLockUtils.nonce |
9429 }); |
9567 }); |
9430 var allPostsUrl = getWPAdminURL('edit.php', { |
9568 var allPostsUrl = getWPAdminURL('edit.php', { |
9431 post_type: Object(external_lodash_["get"])(postType, ['slug']) |
9569 post_type: Object(external_this_lodash_["get"])(postType, ['slug']) |
9432 }); |
9570 }); |
9433 |
9571 |
9434 var allPostsLabel = Object(external_this_wp_i18n_["__"])('Exit the Editor'); |
9572 var allPostsLabel = Object(external_this_wp_i18n_["__"])('Exit the Editor'); |
9435 |
9573 |
9436 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Modal"], { |
9574 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Modal"], { |
9437 title: isTakeover ? Object(external_this_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_this_wp_i18n_["__"])('This post is already being edited.'), |
9575 title: isTakeover ? Object(external_this_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_this_wp_i18n_["__"])('This post is already being edited.'), |
9438 focusOnMount: true, |
9576 focusOnMount: true, |
9439 shouldCloseOnClickOutside: false, |
9577 shouldCloseOnClickOutside: false, |
9440 shouldCloseOnEsc: false, |
9578 shouldCloseOnEsc: false, |
9441 isDismissable: false, |
9579 isDismissible: false, |
9442 className: "editor-post-locked-modal" |
9580 className: "editor-post-locked-modal" |
9443 }, !!userAvatar && Object(external_this_wp_element_["createElement"])("img", { |
9581 }, !!userAvatar && Object(external_this_wp_element_["createElement"])("img", { |
9444 src: userAvatar, |
9582 src: userAvatar, |
9445 alt: Object(external_this_wp_i18n_["__"])('Avatar'), |
9583 alt: Object(external_this_wp_i18n_["__"])('Avatar'), |
9446 className: "editor-post-locked-modal__avatar" |
9584 className: "editor-post-locked-modal__avatar" |
9448 /* translators: %s: user's display name */ |
9586 /* translators: %s: user's display name */ |
9449 Object(external_this_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_this_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_this_wp_element_["createElement"])("div", { |
9587 Object(external_this_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_this_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_this_wp_element_["createElement"])("div", { |
9450 className: "editor-post-locked-modal__buttons" |
9588 className: "editor-post-locked-modal__buttons" |
9451 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9589 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9452 isPrimary: true, |
9590 isPrimary: true, |
9453 isLarge: true, |
|
9454 href: allPostsUrl |
9591 href: allPostsUrl |
9455 }, allPostsLabel))), !isTakeover && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_this_wp_i18n_["sprintf"])( |
9592 }, allPostsLabel))), !isTakeover && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_this_wp_i18n_["sprintf"])( |
9456 /* translators: %s: user's display name */ |
9593 /* translators: %s: user's display name */ |
9457 Object(external_this_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_this_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_this_wp_element_["createElement"])("div", { |
9594 Object(external_this_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_this_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_this_wp_element_["createElement"])("div", { |
9458 className: "editor-post-locked-modal__buttons" |
9595 className: "editor-post-locked-modal__buttons" |
9459 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9596 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9460 isDefault: true, |
9597 isSecondary: true, |
9461 isLarge: true, |
|
9462 href: allPostsUrl |
9598 href: allPostsUrl |
9463 }, allPostsLabel), Object(external_this_wp_element_["createElement"])(post_preview_button, null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9599 }, allPostsLabel), Object(external_this_wp_element_["createElement"])(post_preview_button, null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
9464 isPrimary: true, |
9600 isPrimary: true, |
9465 isLarge: true, |
|
9466 href: unlockUrl |
9601 href: unlockUrl |
9467 }, Object(external_this_wp_i18n_["__"])('Take Over'))))); |
9602 }, Object(external_this_wp_i18n_["__"])('Take Over'))))); |
9468 } |
9603 } |
9469 }]); |
9604 }]); |
9470 |
9605 |
9533 isCurrentPostPublished = _select.isCurrentPostPublished, |
9668 isCurrentPostPublished = _select.isCurrentPostPublished, |
9534 getCurrentPostType = _select.getCurrentPostType, |
9669 getCurrentPostType = _select.getCurrentPostType, |
9535 getCurrentPost = _select.getCurrentPost; |
9670 getCurrentPost = _select.getCurrentPost; |
9536 |
9671 |
9537 return { |
9672 return { |
9538 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9673 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9539 isPublished: isCurrentPostPublished(), |
9674 isPublished: isCurrentPostPublished(), |
9540 postType: getCurrentPostType() |
9675 postType: getCurrentPostType() |
9541 }; |
9676 }; |
9542 }))(PostPendingStatusCheck)); |
9677 }))(PostPendingStatusCheck)); |
9543 |
9678 |
9564 var updatedStatus = status === 'pending' ? 'draft' : 'pending'; |
9699 var updatedStatus = status === 'pending' ? 'draft' : 'pending'; |
9565 onUpdateStatus(updatedStatus); |
9700 onUpdateStatus(updatedStatus); |
9566 }; |
9701 }; |
9567 |
9702 |
9568 return Object(external_this_wp_element_["createElement"])(post_pending_status_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
9703 return Object(external_this_wp_element_["createElement"])(post_pending_status_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
9569 label: Object(external_this_wp_i18n_["__"])('Pending Review'), |
9704 label: Object(external_this_wp_i18n_["__"])('Pending review'), |
9570 checked: status === 'pending', |
9705 checked: status === 'pending', |
9571 onChange: togglePendingStatus |
9706 onChange: togglePendingStatus |
9572 })); |
9707 })); |
9573 } |
9708 } |
9574 /* harmony default export */ var post_pending_status = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { |
9709 /* harmony default export */ var post_pending_status = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { |
9607 ping_status: pingStatus === 'open' ? 'closed' : 'open' |
9742 ping_status: pingStatus === 'open' ? 'closed' : 'open' |
9608 }); |
9743 }); |
9609 }; |
9744 }; |
9610 |
9745 |
9611 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
9746 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
9612 label: Object(external_this_wp_i18n_["__"])('Allow Pingbacks & Trackbacks'), |
9747 label: Object(external_this_wp_i18n_["__"])('Allow pingbacks & trackbacks'), |
9613 checked: pingStatus === 'open', |
9748 checked: pingStatus === 'open', |
9614 onChange: onTogglePingback |
9749 onChange: onTogglePingback |
9615 }); |
9750 }); |
9616 } |
9751 } |
9617 |
9752 |
9641 var isPublished = _ref.isPublished, |
9776 var isPublished = _ref.isPublished, |
9642 isBeingScheduled = _ref.isBeingScheduled, |
9777 isBeingScheduled = _ref.isBeingScheduled, |
9643 isSaving = _ref.isSaving, |
9778 isSaving = _ref.isSaving, |
9644 isPublishing = _ref.isPublishing, |
9779 isPublishing = _ref.isPublishing, |
9645 hasPublishAction = _ref.hasPublishAction, |
9780 hasPublishAction = _ref.hasPublishAction, |
9646 isAutosaving = _ref.isAutosaving; |
9781 isAutosaving = _ref.isAutosaving, |
9782 hasNonPostEntityChanges = _ref.hasNonPostEntityChanges; |
|
9647 |
9783 |
9648 if (isPublishing) { |
9784 if (isPublishing) { |
9649 return Object(external_this_wp_i18n_["__"])('Publishing…'); |
9785 return Object(external_this_wp_i18n_["__"])('Publishing…'); |
9650 } else if (isPublished && isSaving && !isAutosaving) { |
9786 } else if (isPublished && isSaving && !isAutosaving) { |
9651 return Object(external_this_wp_i18n_["__"])('Updating…'); |
9787 return Object(external_this_wp_i18n_["__"])('Updating…'); |
9652 } else if (isBeingScheduled && isSaving && !isAutosaving) { |
9788 } else if (isBeingScheduled && isSaving && !isAutosaving) { |
9653 return Object(external_this_wp_i18n_["__"])('Scheduling…'); |
9789 return Object(external_this_wp_i18n_["__"])('Scheduling…'); |
9654 } |
9790 } |
9655 |
9791 |
9656 if (!hasPublishAction) { |
9792 if (!hasPublishAction) { |
9657 return Object(external_this_wp_i18n_["__"])('Submit for Review'); |
9793 return hasNonPostEntityChanges ? Object(external_this_wp_i18n_["__"])('Submit for Review…') : Object(external_this_wp_i18n_["__"])('Submit for Review'); |
9658 } else if (isPublished) { |
9794 } else if (isPublished) { |
9659 return Object(external_this_wp_i18n_["__"])('Update'); |
9795 return hasNonPostEntityChanges ? Object(external_this_wp_i18n_["__"])('Update…') : Object(external_this_wp_i18n_["__"])('Update'); |
9660 } else if (isBeingScheduled) { |
9796 } else if (isBeingScheduled) { |
9661 return Object(external_this_wp_i18n_["__"])('Schedule'); |
9797 return hasNonPostEntityChanges ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Schedule'); |
9662 } |
9798 } |
9663 |
9799 |
9664 return Object(external_this_wp_i18n_["__"])('Publish'); |
9800 return Object(external_this_wp_i18n_["__"])('Publish'); |
9665 } |
9801 } |
9666 /* harmony default export */ var post_publish_button_label = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { |
9802 /* harmony default export */ var post_publish_button_label = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { |
9678 return { |
9814 return { |
9679 isPublished: isCurrentPostPublished(), |
9815 isPublished: isCurrentPostPublished(), |
9680 isBeingScheduled: isEditedPostBeingScheduled(), |
9816 isBeingScheduled: isEditedPostBeingScheduled(), |
9681 isSaving: forceIsSaving || isSavingPost(), |
9817 isSaving: forceIsSaving || isSavingPost(), |
9682 isPublishing: isPublishingPost(), |
9818 isPublishing: isPublishingPost(), |
9683 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9819 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9684 postType: getCurrentPostType(), |
9820 postType: getCurrentPostType(), |
9685 isAutosaving: isAutosavingPost() |
9821 isAutosaving: isAutosavingPost() |
9686 }; |
9822 }; |
9687 })])(PublishButtonLabel)); |
9823 })])(PublishButtonLabel)); |
9688 |
9824 |
9693 |
9829 |
9694 |
9830 |
9695 |
9831 |
9696 |
9832 |
9697 |
9833 |
9834 |
|
9835 function post_publish_button_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_publish_button_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
9836 |
|
9837 function post_publish_button_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
9838 |
|
9698 /** |
9839 /** |
9699 * External dependencies |
9840 * External dependencies |
9700 */ |
9841 */ |
9701 |
9842 |
9843 |
|
9702 /** |
9844 /** |
9703 * WordPress dependencies |
9845 * WordPress dependencies |
9704 */ |
9846 */ |
9705 |
9847 |
9706 |
9848 |
9707 |
9849 |
9708 |
9850 |
9709 |
9851 |
9710 |
9852 |
9711 |
|
9712 /** |
9853 /** |
9713 * Internal dependencies |
9854 * Internal dependencies |
9714 */ |
9855 */ |
9715 |
9856 |
9716 |
9857 |
9717 var post_publish_button_PostPublishButton = |
9858 var post_publish_button_PostPublishButton = /*#__PURE__*/function (_Component) { |
9718 /*#__PURE__*/ |
|
9719 function (_Component) { |
|
9720 Object(inherits["a" /* default */])(PostPublishButton, _Component); |
9859 Object(inherits["a" /* default */])(PostPublishButton, _Component); |
9860 |
|
9861 var _super = post_publish_button_createSuper(PostPublishButton); |
|
9721 |
9862 |
9722 function PostPublishButton(props) { |
9863 function PostPublishButton(props) { |
9723 var _this; |
9864 var _this; |
9724 |
9865 |
9725 Object(classCallCheck["a" /* default */])(this, PostPublishButton); |
9866 Object(classCallCheck["a" /* default */])(this, PostPublishButton); |
9726 |
9867 |
9727 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishButton).call(this, props)); |
9868 _this = _super.call(this, props); |
9728 _this.buttonNode = Object(external_this_wp_element_["createRef"])(); |
9869 _this.buttonNode = Object(external_this_wp_element_["createRef"])(); |
9870 _this.createOnClick = _this.createOnClick.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
9871 _this.closeEntitiesSavedStates = _this.closeEntitiesSavedStates.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
9872 _this.state = { |
|
9873 entitiesSavedStatesCallback: false |
|
9874 }; |
|
9729 return _this; |
9875 return _this; |
9730 } |
9876 } |
9731 |
9877 |
9732 Object(createClass["a" /* default */])(PostPublishButton, [{ |
9878 Object(createClass["a" /* default */])(PostPublishButton, [{ |
9733 key: "componentDidMount", |
9879 key: "componentDidMount", |
9735 if (this.props.focusOnMount) { |
9881 if (this.props.focusOnMount) { |
9736 this.buttonNode.current.focus(); |
9882 this.buttonNode.current.focus(); |
9737 } |
9883 } |
9738 } |
9884 } |
9739 }, { |
9885 }, { |
9886 key: "createOnClick", |
|
9887 value: function createOnClick(callback) { |
|
9888 var _this2 = this; |
|
9889 |
|
9890 return function () { |
|
9891 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
9892 args[_key] = arguments[_key]; |
|
9893 } |
|
9894 |
|
9895 var hasNonPostEntityChanges = _this2.props.hasNonPostEntityChanges; |
|
9896 |
|
9897 if (hasNonPostEntityChanges) { |
|
9898 // The modal for multiple entity saving will open, |
|
9899 // hold the callback for saving/publishing the post |
|
9900 // so that we can call it if the post entity is checked. |
|
9901 _this2.setState({ |
|
9902 entitiesSavedStatesCallback: function entitiesSavedStatesCallback() { |
|
9903 return callback.apply(void 0, args); |
|
9904 } |
|
9905 }); // Open the save panel by setting its callback. |
|
9906 // To set a function on the useState hook, we must set it |
|
9907 // with another function (() => myFunction). Passing the |
|
9908 // function on its own will cause an error when called. |
|
9909 |
|
9910 |
|
9911 _this2.props.setEntitiesSavedStatesCallback(function () { |
|
9912 return _this2.closeEntitiesSavedStates; |
|
9913 }); |
|
9914 |
|
9915 return external_this_lodash_["noop"]; |
|
9916 } |
|
9917 |
|
9918 return callback.apply(void 0, args); |
|
9919 }; |
|
9920 } |
|
9921 }, { |
|
9922 key: "closeEntitiesSavedStates", |
|
9923 value: function closeEntitiesSavedStates(savedEntities) { |
|
9924 var _this$props = this.props, |
|
9925 postType = _this$props.postType, |
|
9926 postId = _this$props.postId; |
|
9927 var entitiesSavedStatesCallback = this.state.entitiesSavedStatesCallback; |
|
9928 this.setState({ |
|
9929 entitiesSavedStatesCallback: false |
|
9930 }, function () { |
|
9931 if (savedEntities && Object(external_this_lodash_["some"])(savedEntities, function (elt) { |
|
9932 return elt.kind === 'postType' && elt.name === postType && elt.key === postId; |
|
9933 })) { |
|
9934 // The post entity was checked, call the held callback from `createOnClick`. |
|
9935 entitiesSavedStatesCallback(); |
|
9936 } |
|
9937 }); |
|
9938 } |
|
9939 }, { |
|
9740 key: "render", |
9940 key: "render", |
9741 value: function render() { |
9941 value: function render() { |
9742 var _this$props = this.props, |
9942 var _this$props2 = this.props, |
9743 forceIsDirty = _this$props.forceIsDirty, |
9943 forceIsDirty = _this$props2.forceIsDirty, |
9744 forceIsSaving = _this$props.forceIsSaving, |
9944 forceIsSaving = _this$props2.forceIsSaving, |
9745 hasPublishAction = _this$props.hasPublishAction, |
9945 hasPublishAction = _this$props2.hasPublishAction, |
9746 isBeingScheduled = _this$props.isBeingScheduled, |
9946 isBeingScheduled = _this$props2.isBeingScheduled, |
9747 isOpen = _this$props.isOpen, |
9947 isOpen = _this$props2.isOpen, |
9748 isPostSavingLocked = _this$props.isPostSavingLocked, |
9948 isPostSavingLocked = _this$props2.isPostSavingLocked, |
9749 isPublishable = _this$props.isPublishable, |
9949 isPublishable = _this$props2.isPublishable, |
9750 isPublished = _this$props.isPublished, |
9950 isPublished = _this$props2.isPublished, |
9751 isSaveable = _this$props.isSaveable, |
9951 isSaveable = _this$props2.isSaveable, |
9752 isSaving = _this$props.isSaving, |
9952 isSaving = _this$props2.isSaving, |
9753 isToggle = _this$props.isToggle, |
9953 isToggle = _this$props2.isToggle, |
9754 onSave = _this$props.onSave, |
9954 onSave = _this$props2.onSave, |
9755 onStatusChange = _this$props.onStatusChange, |
9955 onStatusChange = _this$props2.onStatusChange, |
9756 _this$props$onSubmit = _this$props.onSubmit, |
9956 _this$props2$onSubmit = _this$props2.onSubmit, |
9757 onSubmit = _this$props$onSubmit === void 0 ? external_lodash_["noop"] : _this$props$onSubmit, |
9957 onSubmit = _this$props2$onSubmit === void 0 ? external_this_lodash_["noop"] : _this$props2$onSubmit, |
9758 onToggle = _this$props.onToggle, |
9958 onToggle = _this$props2.onToggle, |
9759 visibility = _this$props.visibility; |
9959 visibility = _this$props2.visibility, |
9960 hasNonPostEntityChanges = _this$props2.hasNonPostEntityChanges; |
|
9760 var isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty; |
9961 var isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty; |
9761 var isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty; |
9962 var isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty; |
9762 var publishStatus; |
9963 var publishStatus; |
9763 |
9964 |
9764 if (!hasPublishAction) { |
9965 if (!hasPublishAction) { |
9765 publishStatus = 'pending'; |
9966 publishStatus = 'pending'; |
9967 } else if (visibility === 'private') { |
|
9968 publishStatus = 'private'; |
|
9766 } else if (isBeingScheduled) { |
9969 } else if (isBeingScheduled) { |
9767 publishStatus = 'future'; |
9970 publishStatus = 'future'; |
9768 } else if (visibility === 'private') { |
|
9769 publishStatus = 'private'; |
|
9770 } else { |
9971 } else { |
9771 publishStatus = 'publish'; |
9972 publishStatus = 'publish'; |
9772 } |
9973 } |
9773 |
9974 |
9774 var onClickButton = function onClickButton() { |
9975 var onClickButton = function onClickButton() { |
9788 |
9989 |
9789 onToggle(); |
9990 onToggle(); |
9790 }; |
9991 }; |
9791 |
9992 |
9792 var buttonProps = { |
9993 var buttonProps = { |
9793 'aria-disabled': isButtonDisabled, |
9994 'aria-disabled': isButtonDisabled && !hasNonPostEntityChanges, |
9794 className: 'editor-post-publish-button', |
9995 className: 'editor-post-publish-button', |
9795 isBusy: isSaving && isPublished, |
9996 isBusy: isSaving && isPublished, |
9796 isLarge: true, |
|
9797 isPrimary: true, |
9997 isPrimary: true, |
9798 onClick: onClickButton |
9998 onClick: this.createOnClick(onClickButton) |
9799 }; |
9999 }; |
9800 var toggleProps = { |
10000 var toggleProps = { |
9801 'aria-disabled': isToggleDisabled, |
10001 'aria-disabled': isToggleDisabled && !hasNonPostEntityChanges, |
9802 'aria-expanded': isOpen, |
10002 'aria-expanded': isOpen, |
9803 className: 'editor-post-publish-panel__toggle', |
10003 className: 'editor-post-publish-panel__toggle', |
9804 isBusy: isSaving && isPublished, |
10004 isBusy: isSaving && isPublished, |
9805 isPrimary: true, |
10005 isPrimary: true, |
9806 onClick: onClickToggle |
10006 onClick: this.createOnClick(onClickToggle) |
9807 }; |
10007 }; |
9808 var toggleChildren = isBeingScheduled ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Publish…'); |
10008 var toggleChildren = isBeingScheduled ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Publish'); |
9809 var buttonChildren = Object(external_this_wp_element_["createElement"])(post_publish_button_label, { |
10009 var buttonChildren = Object(external_this_wp_element_["createElement"])(post_publish_button_label, { |
9810 forceIsSaving: forceIsSaving |
10010 forceIsSaving: forceIsSaving, |
10011 hasNonPostEntityChanges: hasNonPostEntityChanges |
|
9811 }); |
10012 }); |
9812 var componentProps = isToggle ? toggleProps : buttonProps; |
10013 var componentProps = isToggle ? toggleProps : buttonProps; |
9813 var componentChildren = isToggle ? toggleChildren : buttonChildren; |
10014 var componentChildren = isToggle ? toggleChildren : buttonChildren; |
9814 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({ |
10015 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({ |
9815 ref: this.buttonNode |
10016 ref: this.buttonNode |
9816 }, componentProps), componentChildren, Object(external_this_wp_element_["createElement"])(external_this_wp_nux_["DotTip"], { |
10017 }, componentProps, { |
9817 tipId: "core/editor.publish" |
10018 className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', { |
9818 }, Object(external_this_wp_i18n_["__"])('Finished writing? That’s great, let’s get this published right now. Just click “Publish” and you’re good to go.'))); |
10019 'has-changes-dot': hasNonPostEntityChanges |
10020 }) |
|
10021 }), componentChildren)); |
|
9819 } |
10022 } |
9820 }]); |
10023 }]); |
9821 |
10024 |
9822 return PostPublishButton; |
10025 return PostPublishButton; |
9823 }(external_this_wp_element_["Component"]); |
10026 }(external_this_wp_element_["Component"]); |
9829 isCurrentPostPublished = _select.isCurrentPostPublished, |
10032 isCurrentPostPublished = _select.isCurrentPostPublished, |
9830 isEditedPostSaveable = _select.isEditedPostSaveable, |
10033 isEditedPostSaveable = _select.isEditedPostSaveable, |
9831 isEditedPostPublishable = _select.isEditedPostPublishable, |
10034 isEditedPostPublishable = _select.isEditedPostPublishable, |
9832 isPostSavingLocked = _select.isPostSavingLocked, |
10035 isPostSavingLocked = _select.isPostSavingLocked, |
9833 getCurrentPost = _select.getCurrentPost, |
10036 getCurrentPost = _select.getCurrentPost, |
9834 getCurrentPostType = _select.getCurrentPostType; |
10037 getCurrentPostType = _select.getCurrentPostType, |
10038 getCurrentPostId = _select.getCurrentPostId, |
|
10039 hasNonPostEntityChanges = _select.hasNonPostEntityChanges; |
|
9835 |
10040 |
9836 return { |
10041 return { |
9837 isSaving: isSavingPost(), |
10042 isSaving: isSavingPost(), |
9838 isBeingScheduled: isEditedPostBeingScheduled(), |
10043 isBeingScheduled: isEditedPostBeingScheduled(), |
9839 visibility: getEditedPostVisibility(), |
10044 visibility: getEditedPostVisibility(), |
9840 isSaveable: isEditedPostSaveable(), |
10045 isSaveable: isEditedPostSaveable(), |
9841 isPostSavingLocked: isPostSavingLocked(), |
10046 isPostSavingLocked: isPostSavingLocked(), |
9842 isPublishable: isEditedPostPublishable(), |
10047 isPublishable: isEditedPostPublishable(), |
9843 isPublished: isCurrentPostPublished(), |
10048 isPublished: isCurrentPostPublished(), |
9844 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
10049 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9845 postType: getCurrentPostType() |
10050 postType: getCurrentPostType(), |
10051 postId: getCurrentPostId(), |
|
10052 hasNonPostEntityChanges: hasNonPostEntityChanges() |
|
9846 }; |
10053 }; |
9847 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
10054 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
9848 var _dispatch = dispatch('core/editor'), |
10055 var _dispatch = dispatch('core/editor'), |
9849 editPost = _dispatch.editPost, |
10056 editPost = _dispatch.editPost, |
9850 savePost = _dispatch.savePost; |
10057 savePost = _dispatch.savePost; |
9851 |
10058 |
9852 return { |
10059 return { |
9853 onStatusChange: function onStatusChange(status) { |
10060 onStatusChange: function onStatusChange(status) { |
9854 return editPost({ |
10061 return editPost({ |
9855 status: status |
10062 status: status |
10063 }, { |
|
10064 undoIgnore: true |
|
9856 }); |
10065 }); |
9857 }, |
10066 }, |
9858 onSave: savePost |
10067 onSave: savePost |
9859 }; |
10068 }; |
9860 })])(post_publish_button_PostPublishButton)); |
10069 })])(post_publish_button_PostPublishButton)); |
10070 |
|
10071 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js |
|
10072 var close_small = __webpack_require__(177); |
|
9861 |
10073 |
9862 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js |
10074 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js |
9863 /** |
10075 /** |
9864 * WordPress dependencies |
10076 * WordPress dependencies |
9865 */ |
10077 */ |
9885 |
10097 |
9886 |
10098 |
9887 |
10099 |
9888 |
10100 |
9889 |
10101 |
10102 function post_visibility_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_visibility_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
10103 |
|
10104 function post_visibility_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
10105 |
|
9890 /** |
10106 /** |
9891 * WordPress dependencies |
10107 * WordPress dependencies |
9892 */ |
10108 */ |
9893 |
10109 |
9894 |
10110 |
9895 |
10111 |
9896 |
10112 |
10113 |
|
9897 /** |
10114 /** |
9898 * Internal dependencies |
10115 * Internal dependencies |
9899 */ |
10116 */ |
9900 |
10117 |
9901 |
10118 |
9902 var post_visibility_PostVisibility = |
10119 var post_visibility_PostVisibility = /*#__PURE__*/function (_Component) { |
9903 /*#__PURE__*/ |
|
9904 function (_Component) { |
|
9905 Object(inherits["a" /* default */])(PostVisibility, _Component); |
10120 Object(inherits["a" /* default */])(PostVisibility, _Component); |
10121 |
|
10122 var _super = post_visibility_createSuper(PostVisibility); |
|
9906 |
10123 |
9907 function PostVisibility(props) { |
10124 function PostVisibility(props) { |
9908 var _this; |
10125 var _this; |
9909 |
10126 |
9910 Object(classCallCheck["a" /* default */])(this, PostVisibility); |
10127 Object(classCallCheck["a" /* default */])(this, PostVisibility); |
9911 |
10128 |
9912 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostVisibility).apply(this, arguments)); |
10129 _this = _super.apply(this, arguments); |
9913 _this.setPublic = _this.setPublic.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
10130 _this.setPublic = _this.setPublic.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9914 _this.setPrivate = _this.setPrivate.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
10131 _this.setPrivate = _this.setPrivate.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9915 _this.setPasswordProtected = _this.setPasswordProtected.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
10132 _this.setPasswordProtected = _this.setPasswordProtected.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9916 _this.updatePassword = _this.updatePassword.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
10133 _this.updatePassword = _this.updatePassword.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
9917 _this.state = { |
10134 _this.state = { |
9918 hasPassword: !!props.password |
10135 hasPassword: !!props.password |
9919 }; |
10136 }; |
9920 return _this; |
10137 return _this; |
9921 } |
10138 } |
9933 }); |
10150 }); |
9934 } |
10151 } |
9935 }, { |
10152 }, { |
9936 key: "setPrivate", |
10153 key: "setPrivate", |
9937 value: function setPrivate() { |
10154 value: function setPrivate() { |
9938 if (!window.confirm(Object(external_this_wp_i18n_["__"])('Would you like to privately publish this post now?'))) { |
10155 if ( // eslint-disable-next-line no-alert |
9939 // eslint-disable-line no-alert |
10156 !window.confirm(Object(external_this_wp_i18n_["__"])('Would you like to privately publish this post now?'))) { |
9940 return; |
10157 return; |
9941 } |
10158 } |
9942 |
10159 |
9943 var _this$props2 = this.props, |
10160 var _this$props2 = this.props, |
9944 onUpdateVisibility = _this$props2.onUpdateVisibility, |
10161 onUpdateVisibility = _this$props2.onUpdateVisibility, |
10020 className: "editor-post-visibility__dialog-info" |
10237 className: "editor-post-visibility__dialog-info" |
10021 }, info)); |
10238 }, info)); |
10022 })), this.state.hasPassword && Object(external_this_wp_element_["createElement"])("div", { |
10239 })), this.state.hasPassword && Object(external_this_wp_element_["createElement"])("div", { |
10023 className: "editor-post-visibility__dialog-password", |
10240 className: "editor-post-visibility__dialog-password", |
10024 key: "password-selector" |
10241 key: "password-selector" |
10025 }, Object(external_this_wp_element_["createElement"])("label", { |
10242 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { |
10026 htmlFor: "editor-post-visibility__dialog-password-input-".concat(instanceId), |
10243 as: "label", |
10027 className: "screen-reader-text" |
10244 htmlFor: "editor-post-visibility__dialog-password-input-".concat(instanceId) |
10028 }, Object(external_this_wp_i18n_["__"])('Create password')), Object(external_this_wp_element_["createElement"])("input", { |
10245 }, Object(external_this_wp_i18n_["__"])('Create password')), Object(external_this_wp_element_["createElement"])("input", { |
10029 className: "editor-post-visibility__dialog-password-input", |
10246 className: "editor-post-visibility__dialog-password-input", |
10030 id: "editor-post-visibility__dialog-password-input-".concat(instanceId), |
10247 id: "editor-post-visibility__dialog-password-input-".concat(instanceId), |
10031 type: "text", |
10248 type: "text", |
10032 onChange: this.updatePassword, |
10249 onChange: this.updatePassword, |
10054 editPost = _dispatch.editPost; |
10271 editPost = _dispatch.editPost; |
10055 |
10272 |
10056 return { |
10273 return { |
10057 onSave: savePost, |
10274 onSave: savePost, |
10058 onUpdateVisibility: function onUpdateVisibility(status) { |
10275 onUpdateVisibility: function onUpdateVisibility(status) { |
10059 var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; |
10276 var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; |
10060 editPost({ |
10277 editPost({ |
10061 status: status, |
10278 status: status, |
10062 password: password |
10279 password: password |
10063 }); |
10280 }); |
10064 } |
10281 } |
10083 |
10300 |
10084 function PostVisibilityLabel(_ref) { |
10301 function PostVisibilityLabel(_ref) { |
10085 var visibility = _ref.visibility; |
10302 var visibility = _ref.visibility; |
10086 |
10303 |
10087 var getVisibilityLabel = function getVisibilityLabel() { |
10304 var getVisibilityLabel = function getVisibilityLabel() { |
10088 return Object(external_lodash_["find"])(visibilityOptions, { |
10305 return Object(external_this_lodash_["find"])(visibilityOptions, { |
10089 value: visibility |
10306 value: visibility |
10090 }).label; |
10307 }).label; |
10091 }; |
10308 }; |
10092 |
10309 |
10093 return getVisibilityLabel(visibility); |
10310 return getVisibilityLabel(visibility); |
10110 |
10327 |
10111 |
10328 |
10112 function PostSchedule(_ref) { |
10329 function PostSchedule(_ref) { |
10113 var date = _ref.date, |
10330 var date = _ref.date, |
10114 onUpdateDate = _ref.onUpdateDate; |
10331 onUpdateDate = _ref.onUpdateDate; |
10332 |
|
10333 var onChange = function onChange(newDate) { |
|
10334 onUpdateDate(newDate); |
|
10335 document.activeElement.blur(); |
|
10336 }; |
|
10115 |
10337 |
10116 var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format |
10338 var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format |
10117 // We also make sure this a is not escaped by a "/" |
10339 // We also make sure this a is not escaped by a "/" |
10118 |
10340 |
10119 |
10341 |
10122 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash |
10344 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash |
10123 ); |
10345 ); |
10124 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DateTimePicker"], { |
10346 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DateTimePicker"], { |
10125 key: "date-time-picker", |
10347 key: "date-time-picker", |
10126 currentDate: date, |
10348 currentDate: date, |
10127 onChange: onUpdateDate, |
10349 onChange: onChange, |
10128 is12Hour: is12HourTime |
10350 is12Hour: is12HourTime |
10129 }); |
10351 }); |
10130 } |
10352 } |
10131 /* harmony default export */ var post_schedule = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
10353 /* harmony default export */ var post_schedule = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
10132 return { |
10354 return { |
10153 var date = _ref.date, |
10375 var date = _ref.date, |
10154 isFloating = _ref.isFloating; |
10376 isFloating = _ref.isFloating; |
10155 |
10377 |
10156 var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); |
10378 var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); |
10157 |
10379 |
10158 return date && !isFloating ? Object(external_this_wp_date_["dateI18n"])(settings.formats.datetimeAbbreviated, date) : Object(external_this_wp_i18n_["__"])('Immediately'); |
10380 return date && !isFloating ? Object(external_this_wp_date_["dateI18n"])("".concat(settings.formats.date, " ").concat(settings.formats.time), date) : Object(external_this_wp_i18n_["__"])('Immediately'); |
10159 } |
10381 } |
10160 /* harmony default export */ var post_schedule_label = (Object(external_this_wp_data_["withSelect"])(function (select) { |
10382 /* harmony default export */ var post_schedule_label = (Object(external_this_wp_data_["withSelect"])(function (select) { |
10161 return { |
10383 return { |
10162 date: select('core/editor').getEditedPostAttribute('date'), |
10384 date: select('core/editor').getEditedPostAttribute('date'), |
10163 isFloating: select('core/editor').isEditedPostDateFloating() |
10385 isFloating: select('core/editor').isEditedPostDateFloating() |
10172 |
10394 |
10173 |
10395 |
10174 |
10396 |
10175 |
10397 |
10176 |
10398 |
10399 function flat_term_selector_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (flat_term_selector_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
10400 |
|
10401 function flat_term_selector_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
10402 |
|
10403 function flat_term_selector_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
10404 |
|
10405 function flat_term_selector_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { flat_term_selector_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { flat_term_selector_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
10177 |
10406 |
10178 /** |
10407 /** |
10179 * External dependencies |
10408 * External dependencies |
10180 */ |
10409 */ |
10181 |
10410 |
10205 var isSameTermName = function isSameTermName(termA, termB) { |
10434 var isSameTermName = function isSameTermName(termA, termB) { |
10206 return termA.toLowerCase() === termB.toLowerCase(); |
10435 return termA.toLowerCase() === termB.toLowerCase(); |
10207 }; |
10436 }; |
10208 /** |
10437 /** |
10209 * Returns a term object with name unescaped. |
10438 * Returns a term object with name unescaped. |
10210 * The unescape of the name propery is done using lodash unescape function. |
10439 * The unescape of the name property is done using lodash unescape function. |
10211 * |
10440 * |
10212 * @param {Object} term The term object to unescape. |
10441 * @param {Object} term The term object to unescape. |
10213 * |
10442 * |
10214 * @return {Object} Term object with name property unescaped. |
10443 * @return {Object} Term object with name property unescaped. |
10215 */ |
10444 */ |
10216 |
10445 |
10217 |
10446 |
10218 var flat_term_selector_unescapeTerm = function unescapeTerm(term) { |
10447 var flat_term_selector_unescapeTerm = function unescapeTerm(term) { |
10219 return Object(objectSpread["a" /* default */])({}, term, { |
10448 return flat_term_selector_objectSpread({}, term, { |
10220 name: Object(external_lodash_["unescape"])(term.name) |
10449 name: Object(external_this_lodash_["unescape"])(term.name) |
10221 }); |
10450 }); |
10222 }; |
10451 }; |
10223 /** |
10452 /** |
10224 * Returns an array of term objects with names unescaped. |
10453 * Returns an array of term objects with names unescaped. |
10225 * The unescape of each term is performed using the unescapeTerm function. |
10454 * The unescape of each term is performed using the unescapeTerm function. |
10226 * |
10455 * |
10227 * @param {Object[]} terms Array of term objects to unescape. |
10456 * @param {Object[]} terms Array of term objects to unescape. |
10228 * |
10457 * |
10229 * @return {Object[]} Array of therm objects unscaped. |
10458 * @return {Object[]} Array of term objects unescaped. |
10230 */ |
10459 */ |
10231 |
10460 |
10232 |
10461 |
10233 var flat_term_selector_unescapeTerms = function unescapeTerms(terms) { |
10462 var flat_term_selector_unescapeTerms = function unescapeTerms(terms) { |
10234 return Object(external_lodash_["map"])(terms, flat_term_selector_unescapeTerm); |
10463 return Object(external_this_lodash_["map"])(terms, flat_term_selector_unescapeTerm); |
10235 }; |
10464 }; |
10236 |
10465 |
10237 var flat_term_selector_FlatTermSelector = |
10466 var flat_term_selector_FlatTermSelector = /*#__PURE__*/function (_Component) { |
10238 /*#__PURE__*/ |
|
10239 function (_Component) { |
|
10240 Object(inherits["a" /* default */])(FlatTermSelector, _Component); |
10467 Object(inherits["a" /* default */])(FlatTermSelector, _Component); |
10468 |
|
10469 var _super = flat_term_selector_createSuper(FlatTermSelector); |
|
10241 |
10470 |
10242 function FlatTermSelector() { |
10471 function FlatTermSelector() { |
10243 var _this; |
10472 var _this; |
10244 |
10473 |
10245 Object(classCallCheck["a" /* default */])(this, FlatTermSelector); |
10474 Object(classCallCheck["a" /* default */])(this, FlatTermSelector); |
10246 |
10475 |
10247 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(FlatTermSelector).apply(this, arguments)); |
10476 _this = _super.apply(this, arguments); |
10248 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
10477 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
10249 _this.searchTerms = Object(external_lodash_["throttle"])(_this.searchTerms.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))), 500); |
10478 _this.searchTerms = Object(external_this_lodash_["throttle"])(_this.searchTerms.bind(Object(assertThisInitialized["a" /* default */])(_this)), 500); |
10250 _this.findOrCreateTerm = _this.findOrCreateTerm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
10479 _this.findOrCreateTerm = _this.findOrCreateTerm.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
10251 _this.state = { |
10480 _this.state = { |
10252 loading: !Object(external_lodash_["isEmpty"])(_this.props.terms), |
10481 loading: !Object(external_this_lodash_["isEmpty"])(_this.props.terms), |
10253 availableTerms: [], |
10482 availableTerms: [], |
10254 selectedTerms: [] |
10483 selectedTerms: [] |
10255 }; |
10484 }; |
10256 return _this; |
10485 return _this; |
10257 } |
10486 } |
10259 Object(createClass["a" /* default */])(FlatTermSelector, [{ |
10488 Object(createClass["a" /* default */])(FlatTermSelector, [{ |
10260 key: "componentDidMount", |
10489 key: "componentDidMount", |
10261 value: function componentDidMount() { |
10490 value: function componentDidMount() { |
10262 var _this2 = this; |
10491 var _this2 = this; |
10263 |
10492 |
10264 if (!Object(external_lodash_["isEmpty"])(this.props.terms)) { |
10493 if (!Object(external_this_lodash_["isEmpty"])(this.props.terms)) { |
10265 this.initRequest = this.fetchTerms({ |
10494 this.initRequest = this.fetchTerms({ |
10266 include: this.props.terms.join(','), |
10495 include: this.props.terms.join(','), |
10267 per_page: -1 |
10496 per_page: -1 |
10268 }); |
10497 }); |
10269 this.initRequest.then(function () { |
10498 this.initRequest.then(function () { |
10282 } |
10511 } |
10283 } |
10512 } |
10284 }, { |
10513 }, { |
10285 key: "componentWillUnmount", |
10514 key: "componentWillUnmount", |
10286 value: function componentWillUnmount() { |
10515 value: function componentWillUnmount() { |
10287 Object(external_lodash_["invoke"])(this.initRequest, ['abort']); |
10516 Object(external_this_lodash_["invoke"])(this.initRequest, ['abort']); |
10288 Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); |
10517 Object(external_this_lodash_["invoke"])(this.searchRequest, ['abort']); |
10289 } |
10518 } |
10290 }, { |
10519 }, { |
10291 key: "componentDidUpdate", |
10520 key: "componentDidUpdate", |
10292 value: function componentDidUpdate(prevProps) { |
10521 value: function componentDidUpdate(prevProps) { |
10293 if (prevProps.terms !== this.props.terms) { |
10522 if (prevProps.terms !== this.props.terms) { |
10300 var _this3 = this; |
10529 var _this3 = this; |
10301 |
10530 |
10302 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
10531 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
10303 var taxonomy = this.props.taxonomy; |
10532 var taxonomy = this.props.taxonomy; |
10304 |
10533 |
10305 var query = Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, params); |
10534 var query = flat_term_selector_objectSpread({}, DEFAULT_QUERY, {}, params); |
10306 |
10535 |
10307 var request = external_this_wp_apiFetch_default()({ |
10536 var request = external_this_wp_apiFetch_default()({ |
10308 path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), query) |
10537 path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), query) |
10309 }); |
10538 }); |
10310 request.then(flat_term_selector_unescapeTerms).then(function (terms) { |
10539 request.then(flat_term_selector_unescapeTerms).then(function (terms) { |
10311 _this3.setState(function (state) { |
10540 _this3.setState(function (state) { |
10312 return { |
10541 return { |
10313 availableTerms: state.availableTerms.concat(terms.filter(function (term) { |
10542 availableTerms: state.availableTerms.concat(terms.filter(function (term) { |
10314 return !Object(external_lodash_["find"])(state.availableTerms, function (availableTerm) { |
10543 return !Object(external_this_lodash_["find"])(state.availableTerms, function (availableTerm) { |
10315 return availableTerm.id === term.id; |
10544 return availableTerm.id === term.id; |
10316 }); |
10545 }); |
10317 })) |
10546 })) |
10318 }; |
10547 }; |
10319 }); |
10548 }); |
10326 key: "updateSelectedTerms", |
10555 key: "updateSelectedTerms", |
10327 value: function updateSelectedTerms() { |
10556 value: function updateSelectedTerms() { |
10328 var _this4 = this; |
10557 var _this4 = this; |
10329 |
10558 |
10330 var terms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
10559 var terms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
10331 var selectedTerms = terms.reduce(function (result, termId) { |
10560 var selectedTerms = terms.reduce(function (accumulator, termId) { |
10332 var termObject = Object(external_lodash_["find"])(_this4.state.availableTerms, function (term) { |
10561 var termObject = Object(external_this_lodash_["find"])(_this4.state.availableTerms, function (term) { |
10333 return term.id === termId; |
10562 return term.id === termId; |
10334 }); |
10563 }); |
10335 |
10564 |
10336 if (termObject) { |
10565 if (termObject) { |
10337 result.push(termObject.name); |
10566 accumulator.push(termObject.name); |
10338 } |
10567 } |
10339 |
10568 |
10340 return result; |
10569 return accumulator; |
10341 }, []); |
10570 }, []); |
10342 this.setState({ |
10571 this.setState({ |
10343 selectedTerms: selectedTerms |
10572 selectedTerms: selectedTerms |
10344 }); |
10573 }); |
10345 } |
10574 } |
10347 key: "findOrCreateTerm", |
10576 key: "findOrCreateTerm", |
10348 value: function findOrCreateTerm(termName) { |
10577 value: function findOrCreateTerm(termName) { |
10349 var _this5 = this; |
10578 var _this5 = this; |
10350 |
10579 |
10351 var taxonomy = this.props.taxonomy; |
10580 var taxonomy = this.props.taxonomy; |
10352 var termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists. |
10581 var termNameEscaped = Object(external_this_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists. |
10353 |
10582 |
10354 return external_this_wp_apiFetch_default()({ |
10583 return external_this_wp_apiFetch_default()({ |
10355 path: "/wp/v2/".concat(taxonomy.rest_base), |
10584 path: "/wp/v2/".concat(taxonomy.rest_base), |
10356 method: 'POST', |
10585 method: 'POST', |
10357 data: { |
10586 data: { |
10361 var errorCode = error.code; |
10590 var errorCode = error.code; |
10362 |
10591 |
10363 if (errorCode === 'term_exists') { |
10592 if (errorCode === 'term_exists') { |
10364 // If the terms exist, fetch it instead of creating a new one. |
10593 // If the terms exist, fetch it instead of creating a new one. |
10365 _this5.addRequest = external_this_wp_apiFetch_default()({ |
10594 _this5.addRequest = external_this_wp_apiFetch_default()({ |
10366 path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, { |
10595 path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), flat_term_selector_objectSpread({}, DEFAULT_QUERY, { |
10367 search: termNameEscaped |
10596 search: termNameEscaped |
10368 })) |
10597 })) |
10369 }).then(flat_term_selector_unescapeTerms); |
10598 }).then(flat_term_selector_unescapeTerms); |
10370 return _this5.addRequest.then(function (searchResult) { |
10599 return _this5.addRequest.then(function (searchResult) { |
10371 return Object(external_lodash_["find"])(searchResult, function (result) { |
10600 return Object(external_this_lodash_["find"])(searchResult, function (result) { |
10372 return isSameTermName(result.name, termName); |
10601 return isSameTermName(result.name, termName); |
10373 }); |
10602 }); |
10374 }); |
10603 }); |
10375 } |
10604 } |
10376 |
10605 |
10380 }, { |
10609 }, { |
10381 key: "onChange", |
10610 key: "onChange", |
10382 value: function onChange(termNames) { |
10611 value: function onChange(termNames) { |
10383 var _this6 = this; |
10612 var _this6 = this; |
10384 |
10613 |
10385 var uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, function (term) { |
10614 var uniqueTerms = Object(external_this_lodash_["uniqBy"])(termNames, function (term) { |
10386 return term.toLowerCase(); |
10615 return term.toLowerCase(); |
10387 }); |
10616 }); |
10388 this.setState({ |
10617 this.setState({ |
10389 selectedTerms: uniqueTerms |
10618 selectedTerms: uniqueTerms |
10390 }); |
10619 }); |
10391 var newTermNames = uniqueTerms.filter(function (termName) { |
10620 var newTermNames = uniqueTerms.filter(function (termName) { |
10392 return !Object(external_lodash_["find"])(_this6.state.availableTerms, function (term) { |
10621 return !Object(external_this_lodash_["find"])(_this6.state.availableTerms, function (term) { |
10393 return isSameTermName(term.name, termName); |
10622 return isSameTermName(term.name, termName); |
10394 }); |
10623 }); |
10395 }); |
10624 }); |
10396 |
10625 |
10397 var termNamesToIds = function termNamesToIds(names, availableTerms) { |
10626 var termNamesToIds = function termNamesToIds(names, availableTerms) { |
10398 return names.map(function (termName) { |
10627 return names.map(function (termName) { |
10399 return Object(external_lodash_["find"])(availableTerms, function (term) { |
10628 return Object(external_this_lodash_["find"])(availableTerms, function (term) { |
10400 return isSameTermName(term.name, termName); |
10629 return isSameTermName(term.name, termName); |
10401 }).id; |
10630 }).id; |
10402 }); |
10631 }); |
10403 }; |
10632 }; |
10404 |
10633 |
10418 } |
10647 } |
10419 }, { |
10648 }, { |
10420 key: "searchTerms", |
10649 key: "searchTerms", |
10421 value: function searchTerms() { |
10650 value: function searchTerms() { |
10422 var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; |
10651 var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; |
10423 Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); |
10652 Object(external_this_lodash_["invoke"])(this.searchRequest, ['abort']); |
10424 this.searchRequest = this.fetchTerms({ |
10653 this.searchRequest = this.fetchTerms({ |
10425 search: search |
10654 search: search |
10426 }); |
10655 }); |
10427 } |
10656 } |
10428 }, { |
10657 }, { |
10442 availableTerms = _this$state.availableTerms, |
10671 availableTerms = _this$state.availableTerms, |
10443 selectedTerms = _this$state.selectedTerms; |
10672 selectedTerms = _this$state.selectedTerms; |
10444 var termNames = availableTerms.map(function (term) { |
10673 var termNames = availableTerms.map(function (term) { |
10445 return term.name; |
10674 return term.name; |
10446 }); |
10675 }); |
10447 var newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Add New Tag') : Object(external_this_wp_i18n_["__"])('Add New Term')); |
10676 var newTermLabel = Object(external_this_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Add new tag') : Object(external_this_wp_i18n_["__"])('Add new Term')); |
10448 var singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Tag') : Object(external_this_wp_i18n_["__"])('Term')); |
10677 var singularName = Object(external_this_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Tag') : Object(external_this_wp_i18n_["__"])('Term')); |
10449 var termAddedLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s added', 'term'), singularName); |
10678 var termAddedLabel = Object(external_this_wp_i18n_["sprintf"])( |
10450 var termRemovedLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s removed', 'term'), singularName); |
10679 /* translators: %s: term name. */ |
10451 var removeTermLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('Remove %s', 'term'), singularName); |
10680 Object(external_this_wp_i18n_["_x"])('%s added', 'term'), singularName); |
10681 var termRemovedLabel = Object(external_this_wp_i18n_["sprintf"])( |
|
10682 /* translators: %s: term name. */ |
|
10683 Object(external_this_wp_i18n_["_x"])('%s removed', 'term'), singularName); |
|
10684 var removeTermLabel = Object(external_this_wp_i18n_["sprintf"])( |
|
10685 /* translators: %s: term name. */ |
|
10686 Object(external_this_wp_i18n_["_x"])('Remove %s', 'term'), singularName); |
|
10452 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FormTokenField"], { |
10687 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FormTokenField"], { |
10453 value: selectedTerms, |
10688 value: selectedTerms, |
10454 suggestions: termNames, |
10689 suggestions: termNames, |
10455 onChange: this.onChange, |
10690 onChange: this.onChange, |
10456 onInputChange: this.searchTerms, |
10691 onInputChange: this.searchTerms, |
10478 var _select2 = select('core'), |
10713 var _select2 = select('core'), |
10479 getTaxonomy = _select2.getTaxonomy; |
10714 getTaxonomy = _select2.getTaxonomy; |
10480 |
10715 |
10481 var taxonomy = getTaxonomy(slug); |
10716 var taxonomy = getTaxonomy(slug); |
10482 return { |
10717 return { |
10483 hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, |
10718 hasCreateAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, |
10484 hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, |
10719 hasAssignAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, |
10485 terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], |
10720 terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], |
10486 taxonomy: taxonomy |
10721 taxonomy: taxonomy |
10487 }; |
10722 }; |
10488 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
10723 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
10489 return { |
10724 return { |
10498 |
10733 |
10499 |
10734 |
10500 |
10735 |
10501 |
10736 |
10502 |
10737 |
10738 |
|
10739 function maybe_tags_panel_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (maybe_tags_panel_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
10740 |
|
10741 function maybe_tags_panel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
10503 |
10742 |
10504 /** |
10743 /** |
10505 * External dependencies |
10744 * External dependencies |
10506 */ |
10745 */ |
10507 |
10746 |
10531 }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_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_this_wp_element_["createElement"])(flat_term_selector, { |
10770 }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_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_this_wp_element_["createElement"])(flat_term_selector, { |
10532 slug: 'post_tag' |
10771 slug: 'post_tag' |
10533 })); |
10772 })); |
10534 }; |
10773 }; |
10535 |
10774 |
10536 var maybe_tags_panel_MaybeTagsPanel = |
10775 var maybe_tags_panel_MaybeTagsPanel = /*#__PURE__*/function (_Component) { |
10537 /*#__PURE__*/ |
|
10538 function (_Component) { |
|
10539 Object(inherits["a" /* default */])(MaybeTagsPanel, _Component); |
10776 Object(inherits["a" /* default */])(MaybeTagsPanel, _Component); |
10777 |
|
10778 var _super = maybe_tags_panel_createSuper(MaybeTagsPanel); |
|
10540 |
10779 |
10541 function MaybeTagsPanel(props) { |
10780 function MaybeTagsPanel(props) { |
10542 var _this; |
10781 var _this; |
10543 |
10782 |
10544 Object(classCallCheck["a" /* default */])(this, MaybeTagsPanel); |
10783 Object(classCallCheck["a" /* default */])(this, MaybeTagsPanel); |
10545 |
10784 |
10546 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(MaybeTagsPanel).call(this, props)); |
10785 _this = _super.call(this, props); |
10547 _this.state = { |
10786 _this.state = { |
10548 hadTagsWhenOpeningThePanel: props.hasTags |
10787 hadTagsWhenOpeningThePanel: props.hasTags |
10549 }; |
10788 }; |
10550 return _this; |
10789 return _this; |
10551 } |
10790 } |
10579 var postType = select('core/editor').getCurrentPostType(); |
10818 var postType = select('core/editor').getCurrentPostType(); |
10580 var tagsTaxonomy = select('core').getTaxonomy('post_tag'); |
10819 var tagsTaxonomy = select('core').getTaxonomy('post_tag'); |
10581 var tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base); |
10820 var tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base); |
10582 return { |
10821 return { |
10583 areTagsFetched: tagsTaxonomy !== undefined, |
10822 areTagsFetched: tagsTaxonomy !== undefined, |
10584 isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, function (type) { |
10823 isPostTypeSupported: tagsTaxonomy && Object(external_this_lodash_["some"])(tagsTaxonomy.types, function (type) { |
10585 return type === postType; |
10824 return type === postType; |
10586 }), |
10825 }), |
10587 hasTags: tags && tags.length |
10826 hasTags: tags && tags.length |
10588 }; |
10827 }; |
10589 }), Object(external_this_wp_compose_["ifCondition"])(function (_ref) { |
10828 }), Object(external_this_wp_compose_["ifCondition"])(function (_ref) { |
10636 initialOpen: false, |
10875 initialOpen: false, |
10637 title: panelBodyTitle |
10876 title: panelBodyTitle |
10638 }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_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_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(maybe_post_format_panel_PostFormatSuggestion, { |
10877 }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_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_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(maybe_post_format_panel_PostFormatSuggestion, { |
10639 onUpdatePostFormat: onUpdatePostFormat, |
10878 onUpdatePostFormat: onUpdatePostFormat, |
10640 suggestedPostFormat: suggestion.id, |
10879 suggestedPostFormat: suggestion.id, |
10641 suggestionText: Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption) |
10880 suggestionText: Object(external_this_wp_i18n_["sprintf"])( |
10881 /* translators: %s: post format */ |
|
10882 Object(external_this_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption) |
|
10642 }))); |
10883 }))); |
10643 }; |
10884 }; |
10644 |
10885 |
10645 var maybe_post_format_panel_getSuggestion = function getSuggestion(supportedFormats, suggestedPostFormat) { |
10886 var maybe_post_format_panel_getSuggestion = function getSuggestion(supportedFormats, suggestedPostFormat) { |
10646 var formats = POST_FORMATS.filter(function (format) { |
10887 var formats = POST_FORMATS.filter(function (format) { |
10647 return Object(external_lodash_["includes"])(supportedFormats, format.id); |
10888 return Object(external_this_lodash_["includes"])(supportedFormats, format.id); |
10648 }); |
10889 }); |
10649 return Object(external_lodash_["find"])(formats, function (format) { |
10890 return Object(external_this_lodash_["find"])(formats, function (format) { |
10650 return format.id === suggestedPostFormat; |
10891 return format.id === suggestedPostFormat; |
10651 }); |
10892 }); |
10652 }; |
10893 }; |
10653 |
10894 |
10654 /* harmony default export */ var maybe_post_format_panel = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { |
10895 /* harmony default export */ var maybe_post_format_panel = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { |
10655 var _select = select('core/editor'), |
10896 var _select = select('core/editor'), |
10656 getEditedPostAttribute = _select.getEditedPostAttribute, |
10897 getEditedPostAttribute = _select.getEditedPostAttribute, |
10657 getSuggestedPostFormat = _select.getSuggestedPostFormat; |
10898 getSuggestedPostFormat = _select.getSuggestedPostFormat; |
10658 |
10899 |
10659 var supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); |
10900 var supportedFormats = Object(external_this_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); |
10660 return { |
10901 return { |
10661 currentPostFormat: getEditedPostAttribute('format'), |
10902 currentPostFormat: getEditedPostAttribute('format'), |
10662 suggestion: maybe_post_format_panel_getSuggestion(supportedFormats, getSuggestedPostFormat()) |
10903 suggestion: maybe_post_format_panel_getSuggestion(supportedFormats, getSuggestedPostFormat()) |
10663 }; |
10904 }; |
10664 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
10905 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
10683 */ |
10924 */ |
10684 |
10925 |
10685 /** |
10926 /** |
10686 * WordPress dependencies |
10927 * WordPress dependencies |
10687 */ |
10928 */ |
10688 |
|
10689 |
10929 |
10690 |
10930 |
10691 |
10931 |
10692 |
10932 |
10693 /** |
10933 /** |
10730 initialOpen: false, |
10970 initialOpen: false, |
10731 title: [Object(external_this_wp_i18n_["__"])('Publish:'), Object(external_this_wp_element_["createElement"])("span", { |
10971 title: [Object(external_this_wp_i18n_["__"])('Publish:'), Object(external_this_wp_element_["createElement"])("span", { |
10732 className: "editor-post-publish-panel__link", |
10972 className: "editor-post-publish-panel__link", |
10733 key: "label" |
10973 key: "label" |
10734 }, Object(external_this_wp_element_["createElement"])(post_schedule_label, null))] |
10974 }, Object(external_this_wp_element_["createElement"])(post_schedule_label, null))] |
10735 }, Object(external_this_wp_element_["createElement"])(post_schedule, null)), Object(external_this_wp_element_["createElement"])(maybe_post_format_panel, null), Object(external_this_wp_element_["createElement"])(maybe_tags_panel, null), children)); |
10975 }, Object(external_this_wp_element_["createElement"])(post_schedule, null))), Object(external_this_wp_element_["createElement"])(maybe_post_format_panel, null), Object(external_this_wp_element_["createElement"])(maybe_tags_panel, null), children); |
10736 } |
10976 } |
10737 |
10977 |
10738 /* harmony default export */ var prepublish = (Object(external_this_wp_data_["withSelect"])(function (select) { |
10978 /* harmony default export */ var prepublish = (Object(external_this_wp_data_["withSelect"])(function (select) { |
10739 var _select = select('core/editor'), |
10979 var _select = select('core/editor'), |
10740 getCurrentPost = _select.getCurrentPost, |
10980 getCurrentPost = _select.getCurrentPost, |
10741 isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled; |
10981 isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled; |
10742 |
10982 |
10743 return { |
10983 return { |
10744 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
10984 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
10745 isBeingScheduled: isEditedPostBeingScheduled() |
10985 isBeingScheduled: isEditedPostBeingScheduled() |
10746 }; |
10986 }; |
10747 })(PostPublishPanelPrepublish)); |
10987 })(PostPublishPanelPrepublish)); |
10748 |
10988 |
10749 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js |
10989 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js |
10753 |
10993 |
10754 |
10994 |
10755 |
10995 |
10756 |
10996 |
10757 |
10997 |
10998 function postpublish_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (postpublish_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
10999 |
|
11000 function postpublish_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
11001 |
|
10758 /** |
11002 /** |
10759 * External dependencies |
11003 * External dependencies |
10760 */ |
11004 */ |
10761 |
11005 |
10762 /** |
11006 /** |
10766 |
11010 |
10767 |
11011 |
10768 |
11012 |
10769 |
11013 |
10770 |
11014 |
11015 |
|
10771 /** |
11016 /** |
10772 * Internal dependencies |
11017 * Internal dependencies |
10773 */ |
11018 */ |
10774 |
11019 |
10775 |
11020 |
10776 |
11021 var POSTNAME = '%postname%'; |
10777 var postpublish_PostPublishPanelPostpublish = |
11022 /** |
10778 /*#__PURE__*/ |
11023 * Returns URL for a future post. |
10779 function (_Component) { |
11024 * |
11025 * @param {Object} post Post object. |
|
11026 * |
|
11027 * @return {string} PostPublish URL. |
|
11028 */ |
|
11029 |
|
11030 var getFuturePostUrl = function getFuturePostUrl(post) { |
|
11031 var slug = post.slug; |
|
11032 |
|
11033 if (post.permalink_template.includes(POSTNAME)) { |
|
11034 return post.permalink_template.replace(POSTNAME, slug); |
|
11035 } |
|
11036 |
|
11037 return post.permalink_template; |
|
11038 }; |
|
11039 |
|
11040 var postpublish_PostPublishPanelPostpublish = /*#__PURE__*/function (_Component) { |
|
10780 Object(inherits["a" /* default */])(PostPublishPanelPostpublish, _Component); |
11041 Object(inherits["a" /* default */])(PostPublishPanelPostpublish, _Component); |
11042 |
|
11043 var _super = postpublish_createSuper(PostPublishPanelPostpublish); |
|
10781 |
11044 |
10782 function PostPublishPanelPostpublish() { |
11045 function PostPublishPanelPostpublish() { |
10783 var _this; |
11046 var _this; |
10784 |
11047 |
10785 Object(classCallCheck["a" /* default */])(this, PostPublishPanelPostpublish); |
11048 Object(classCallCheck["a" /* default */])(this, PostPublishPanelPostpublish); |
10786 |
11049 |
10787 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishPanelPostpublish).apply(this, arguments)); |
11050 _this = _super.apply(this, arguments); |
10788 _this.state = { |
11051 _this.state = { |
10789 showCopyConfirmation: false |
11052 showCopyConfirmation: false |
10790 }; |
11053 }; |
10791 _this.onCopy = _this.onCopy.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11054 _this.onCopy = _this.onCopy.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
10792 _this.onSelectInput = _this.onSelectInput.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11055 _this.onSelectInput = _this.onSelectInput.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
10793 _this.postLink = Object(external_this_wp_element_["createRef"])(); |
11056 _this.postLink = Object(external_this_wp_element_["createRef"])(); |
10794 return _this; |
11057 return _this; |
10795 } |
11058 } |
10796 |
11059 |
10797 Object(createClass["a" /* default */])(PostPublishPanelPostpublish, [{ |
11060 Object(createClass["a" /* default */])(PostPublishPanelPostpublish, [{ |
10832 var _this$props = this.props, |
11095 var _this$props = this.props, |
10833 children = _this$props.children, |
11096 children = _this$props.children, |
10834 isScheduled = _this$props.isScheduled, |
11097 isScheduled = _this$props.isScheduled, |
10835 post = _this$props.post, |
11098 post = _this$props.post, |
10836 postType = _this$props.postType; |
11099 postType = _this$props.postType; |
10837 var postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']); |
11100 var postLabel = Object(external_this_lodash_["get"])(postType, ['labels', 'singular_name']); |
10838 var viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']); |
11101 var viewPostLabel = Object(external_this_lodash_["get"])(postType, ['labels', 'view_item']); |
10839 var postPublishNonLinkHeader = isScheduled ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_i18n_["__"])('is now scheduled. It will go live on'), " ", Object(external_this_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_this_wp_i18n_["__"])('is now live.'); |
11102 var link = post.status === 'future' ? getFuturePostUrl(post) : post.link; |
11103 var postPublishNonLinkHeader = isScheduled ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_i18n_["__"])('is now scheduled. It will go live on'), ' ', Object(external_this_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_this_wp_i18n_["__"])('is now live.'); |
|
10840 return Object(external_this_wp_element_["createElement"])("div", { |
11104 return Object(external_this_wp_element_["createElement"])("div", { |
10841 className: "post-publish-panel__postpublish" |
11105 className: "post-publish-panel__postpublish" |
10842 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { |
11106 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { |
10843 className: "post-publish-panel__postpublish-header" |
11107 className: "post-publish-panel__postpublish-header" |
10844 }, Object(external_this_wp_element_["createElement"])("a", { |
11108 }, Object(external_this_wp_element_["createElement"])("a", { |
10845 ref: this.postLink, |
11109 ref: this.postLink, |
10846 href: post.link |
11110 href: link |
10847 }, post.title || Object(external_this_wp_i18n_["__"])('(no title)')), " ", postPublishNonLinkHeader), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])("p", { |
11111 }, Object(external_this_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_this_wp_i18n_["__"])('(no title)')), ' ', postPublishNonLinkHeader), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])("p", { |
10848 className: "post-publish-panel__postpublish-subheader" |
11112 className: "post-publish-panel__postpublish-subheader" |
10849 }, Object(external_this_wp_element_["createElement"])("strong", null, Object(external_this_wp_i18n_["__"])('What’s next?'))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { |
11113 }, Object(external_this_wp_element_["createElement"])("strong", null, Object(external_this_wp_i18n_["__"])('What’s next?'))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { |
10850 className: "post-publish-panel__postpublish-post-address", |
11114 className: "post-publish-panel__postpublish-post-address", |
10851 readOnly: true, |
11115 readOnly: true, |
10852 label: Object(external_this_wp_i18n_["sprintf"])( |
11116 label: Object(external_this_wp_i18n_["sprintf"])( |
10853 /* translators: %s: post type singular name */ |
11117 /* translators: %s: post type singular name */ |
10854 Object(external_this_wp_i18n_["__"])('%s address'), postLabel), |
11118 Object(external_this_wp_i18n_["__"])('%s address'), postLabel), |
10855 value: Object(external_this_wp_url_["safeDecodeURIComponent"])(post.link), |
11119 value: Object(external_this_wp_url_["safeDecodeURIComponent"])(link), |
10856 onFocus: this.onSelectInput |
11120 onFocus: this.onSelectInput |
10857 }), Object(external_this_wp_element_["createElement"])("div", { |
11121 }), Object(external_this_wp_element_["createElement"])("div", { |
10858 className: "post-publish-panel__postpublish-buttons" |
11122 className: "post-publish-panel__postpublish-buttons" |
10859 }, !isScheduled && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11123 }, !isScheduled && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
10860 isDefault: true, |
11124 isSecondary: true, |
10861 href: post.link |
11125 href: link |
10862 }, viewPostLabel), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
11126 }, viewPostLabel), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
10863 isDefault: true, |
11127 isSecondary: true, |
10864 text: post.link, |
11128 text: link, |
10865 onCopy: this.onCopy |
11129 onCopy: this.onCopy |
10866 }, this.state.showCopyConfirmation ? Object(external_this_wp_i18n_["__"])('Copied!') : Object(external_this_wp_i18n_["__"])('Copy Link')))), children); |
11130 }, this.state.showCopyConfirmation ? Object(external_this_wp_i18n_["__"])('Copied!') : Object(external_this_wp_i18n_["__"])('Copy Link')))), children); |
10867 } |
11131 } |
10868 }]); |
11132 }]); |
10869 |
11133 |
10895 |
11159 |
10896 |
11160 |
10897 |
11161 |
10898 |
11162 |
10899 |
11163 |
11164 function post_publish_panel_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_publish_panel_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
11165 |
|
11166 function post_publish_panel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
11167 |
|
10900 /** |
11168 /** |
10901 * External dependencies |
11169 * External dependencies |
10902 */ |
11170 */ |
10903 |
11171 |
10904 /** |
11172 /** |
10908 |
11176 |
10909 |
11177 |
10910 |
11178 |
10911 |
11179 |
10912 |
11180 |
11181 |
|
10913 /** |
11182 /** |
10914 * Internal dependencies |
11183 * Internal dependencies |
10915 */ |
11184 */ |
10916 |
11185 |
10917 |
11186 |
10918 |
11187 |
10919 |
11188 |
10920 var post_publish_panel_PostPublishPanel = |
11189 var post_publish_panel_PostPublishPanel = /*#__PURE__*/function (_Component) { |
10921 /*#__PURE__*/ |
|
10922 function (_Component) { |
|
10923 Object(inherits["a" /* default */])(PostPublishPanel, _Component); |
11190 Object(inherits["a" /* default */])(PostPublishPanel, _Component); |
11191 |
|
11192 var _super = post_publish_panel_createSuper(PostPublishPanel); |
|
10924 |
11193 |
10925 function PostPublishPanel() { |
11194 function PostPublishPanel() { |
10926 var _this; |
11195 var _this; |
10927 |
11196 |
10928 Object(classCallCheck["a" /* default */])(this, PostPublishPanel); |
11197 Object(classCallCheck["a" /* default */])(this, PostPublishPanel); |
10929 |
11198 |
10930 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishPanel).apply(this, arguments)); |
11199 _this = _super.apply(this, arguments); |
10931 _this.onSubmit = _this.onSubmit.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11200 _this.onSubmit = _this.onSubmit.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
10932 return _this; |
11201 return _this; |
10933 } |
11202 } |
10934 |
11203 |
10935 Object(createClass["a" /* default */])(PostPublishPanel, [{ |
11204 Object(createClass["a" /* default */])(PostPublishPanel, [{ |
10936 key: "componentDidUpdate", |
11205 key: "componentDidUpdate", |
10968 onTogglePublishSidebar = _this$props2.onTogglePublishSidebar, |
11237 onTogglePublishSidebar = _this$props2.onTogglePublishSidebar, |
10969 PostPublishExtension = _this$props2.PostPublishExtension, |
11238 PostPublishExtension = _this$props2.PostPublishExtension, |
10970 PrePublishExtension = _this$props2.PrePublishExtension, |
11239 PrePublishExtension = _this$props2.PrePublishExtension, |
10971 additionalProps = Object(objectWithoutProperties["a" /* default */])(_this$props2, ["forceIsDirty", "forceIsSaving", "isBeingScheduled", "isPublished", "isPublishSidebarEnabled", "isScheduled", "isSaving", "onClose", "onTogglePublishSidebar", "PostPublishExtension", "PrePublishExtension"]); |
11240 additionalProps = Object(objectWithoutProperties["a" /* default */])(_this$props2, ["forceIsDirty", "forceIsSaving", "isBeingScheduled", "isPublished", "isPublishSidebarEnabled", "isScheduled", "isSaving", "onClose", "onTogglePublishSidebar", "PostPublishExtension", "PrePublishExtension"]); |
10972 |
11241 |
10973 var propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); |
11242 var propsForPanel = Object(external_this_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); |
10974 var isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; |
11243 var isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; |
10975 var isPrePublish = !isPublishedOrScheduled && !isSaving; |
11244 var isPrePublish = !isPublishedOrScheduled && !isSaving; |
10976 var isPostPublish = isPublishedOrScheduled && !isSaving; |
11245 var isPostPublish = isPublishedOrScheduled && !isSaving; |
10977 return Object(external_this_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ |
11246 return Object(external_this_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ |
10978 className: "editor-post-publish-panel" |
11247 className: "editor-post-publish-panel" |
10979 }, propsForPanel), Object(external_this_wp_element_["createElement"])("div", { |
11248 }, propsForPanel), Object(external_this_wp_element_["createElement"])("div", { |
10980 className: "editor-post-publish-panel__header" |
11249 className: "editor-post-publish-panel__header" |
10981 }, isPostPublish ? Object(external_this_wp_element_["createElement"])("div", { |
11250 }, isPostPublish ? Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
10982 className: "editor-post-publish-panel__header-published" |
11251 onClick: onClose, |
10983 }, isScheduled ? Object(external_this_wp_i18n_["__"])('Scheduled') : Object(external_this_wp_i18n_["__"])('Published')) : Object(external_this_wp_element_["createElement"])("div", { |
11252 icon: close_small["a" /* default */], |
11253 label: Object(external_this_wp_i18n_["__"])('Close panel') |
|
11254 }) : Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { |
|
10984 className: "editor-post-publish-panel__header-publish-button" |
11255 className: "editor-post-publish-panel__header-publish-button" |
10985 }, Object(external_this_wp_element_["createElement"])(post_publish_button, { |
11256 }, Object(external_this_wp_element_["createElement"])(post_publish_button, { |
10986 focusOnMount: true, |
11257 focusOnMount: true, |
10987 onSubmit: this.onSubmit, |
11258 onSubmit: this.onSubmit, |
10988 forceIsDirty: forceIsDirty, |
11259 forceIsDirty: forceIsDirty, |
10989 forceIsSaving: forceIsSaving |
11260 forceIsSaving: forceIsSaving |
10990 }), Object(external_this_wp_element_["createElement"])("span", { |
11261 })), Object(external_this_wp_element_["createElement"])("div", { |
10991 className: "editor-post-publish-panel__spacer" |
11262 className: "editor-post-publish-panel__header-cancel-button" |
10992 })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
11263 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
10993 "aria-expanded": true, |
|
10994 onClick: onClose, |
11264 onClick: onClose, |
10995 icon: "no-alt", |
11265 label: Object(external_this_wp_i18n_["__"])('Close panel'), |
10996 label: Object(external_this_wp_i18n_["__"])('Close panel') |
11266 isSecondary: true |
10997 })), Object(external_this_wp_element_["createElement"])("div", { |
11267 }, Object(external_this_wp_i18n_["__"])('Cancel'))))), Object(external_this_wp_element_["createElement"])("div", { |
10998 className: "editor-post-publish-panel__content" |
11268 className: "editor-post-publish-panel__content" |
10999 }, isPrePublish && Object(external_this_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_this_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_this_wp_element_["createElement"])(postpublish, { |
11269 }, isPrePublish && Object(external_this_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_this_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_this_wp_element_["createElement"])(postpublish, { |
11000 focusOnMount: true |
11270 focusOnMount: true |
11001 }, PostPublishExtension && Object(external_this_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)), Object(external_this_wp_element_["createElement"])("div", { |
11271 }, PostPublishExtension && Object(external_this_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)), Object(external_this_wp_element_["createElement"])("div", { |
11002 className: "editor-post-publish-panel__footer" |
11272 className: "editor-post-publish-panel__footer" |
11026 var _select3 = select('core/editor'), |
11296 var _select3 = select('core/editor'), |
11027 isPublishSidebarEnabled = _select3.isPublishSidebarEnabled; |
11297 isPublishSidebarEnabled = _select3.isPublishSidebarEnabled; |
11028 |
11298 |
11029 var postType = getPostType(getEditedPostAttribute('type')); |
11299 var postType = getPostType(getEditedPostAttribute('type')); |
11030 return { |
11300 return { |
11031 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
11301 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
11032 isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), |
11302 isPostTypeViewable: Object(external_this_lodash_["get"])(postType, ['viewable'], false), |
11033 isBeingScheduled: isEditedPostBeingScheduled(), |
11303 isBeingScheduled: isEditedPostBeingScheduled(), |
11034 isDirty: isEditedPostDirty(), |
11304 isDirty: isEditedPostDirty(), |
11035 isPublished: isCurrentPostPublished(), |
11305 isPublished: isCurrentPostPublished(), |
11036 isPublishSidebarEnabled: isPublishSidebarEnabled(), |
11306 isPublishSidebarEnabled: isPublishSidebarEnabled(), |
11037 isSaving: isSavingPost(), |
11307 isSaving: isSavingPost(), |
11053 } |
11323 } |
11054 } |
11324 } |
11055 }; |
11325 }; |
11056 }), external_this_wp_components_["withFocusReturn"], external_this_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel)); |
11326 }), external_this_wp_components_["withFocusReturn"], external_this_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel)); |
11057 |
11327 |
11328 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
|
11329 var build_module_icon = __webpack_require__(137); |
|
11330 |
|
11331 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js |
|
11332 |
|
11333 |
|
11334 /** |
|
11335 * WordPress dependencies |
|
11336 */ |
|
11337 |
|
11338 var cloud = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
11339 xmlns: "http://www.w3.org/2000/svg", |
|
11340 viewBox: "-2 -2 24 24" |
|
11341 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
11342 d: "M14.9 9c1.8.2 3.1 1.7 3.1 3.5 0 1.9-1.6 3.5-3.5 3.5h-10C2.6 16 1 14.4 1 12.5 1 10.7 2.3 9.3 4.1 9 4 8.9 4 8.7 4 8.5 4 7.1 5.1 6 6.5 6c.3 0 .7.1.9.2C8.1 4.9 9.4 4 11 4c2.2 0 4 1.8 4 4 0 .4-.1.7-.1 1z" |
|
11343 })); |
|
11344 /* harmony default export */ var library_cloud = (cloud); |
|
11345 |
|
11346 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
|
11347 var library_check = __webpack_require__(155); |
|
11348 |
|
11349 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js |
|
11350 |
|
11351 |
|
11352 /** |
|
11353 * WordPress dependencies |
|
11354 */ |
|
11355 |
|
11356 var cloudUpload = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
11357 xmlns: "http://www.w3.org/2000/svg", |
|
11358 viewBox: "-2 -2 24 24" |
|
11359 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
11360 d: "M14.8 9c.1-.3.2-.6.2-1 0-2.2-1.8-4-4-4-1.5 0-2.9.9-3.5 2.2-.3-.1-.7-.2-1-.2C5.1 6 4 7.1 4 8.5c0 .2 0 .4.1.5-1.8.3-3.1 1.7-3.1 3.5C1 14.4 2.6 16 4.5 16H8v-3H5l4.5-4.5L14 13h-3v3h3.5c1.9 0 3.5-1.6 3.5-3.5 0-1.8-1.4-3.3-3.2-3.5z" |
|
11361 })); |
|
11362 /* harmony default export */ var cloud_upload = (cloudUpload); |
|
11363 |
|
11058 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js |
11364 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js |
11059 |
11365 |
11060 |
11366 |
11061 /** |
11367 /** |
11062 * WordPress dependencies |
11368 * WordPress dependencies |
11069 function PostSwitchToDraftButton(_ref) { |
11375 function PostSwitchToDraftButton(_ref) { |
11070 var isSaving = _ref.isSaving, |
11376 var isSaving = _ref.isSaving, |
11071 isPublished = _ref.isPublished, |
11377 isPublished = _ref.isPublished, |
11072 isScheduled = _ref.isScheduled, |
11378 isScheduled = _ref.isScheduled, |
11073 onClick = _ref.onClick; |
11379 onClick = _ref.onClick; |
11380 var isMobileViewport = Object(external_this_wp_compose_["useViewportMatch"])('small', '<'); |
|
11074 |
11381 |
11075 if (!isPublished && !isScheduled) { |
11382 if (!isPublished && !isScheduled) { |
11076 return null; |
11383 return null; |
11077 } |
11384 } |
11078 |
11385 |
11094 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11401 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11095 className: "editor-post-switch-to-draft", |
11402 className: "editor-post-switch-to-draft", |
11096 onClick: onSwitch, |
11403 onClick: onSwitch, |
11097 disabled: isSaving, |
11404 disabled: isSaving, |
11098 isTertiary: true |
11405 isTertiary: true |
11099 }, Object(external_this_wp_i18n_["__"])('Switch to Draft')); |
11406 }, isMobileViewport ? Object(external_this_wp_i18n_["__"])('Draft') : Object(external_this_wp_i18n_["__"])('Switch to draft')); |
11100 } |
11407 } |
11101 |
11408 |
11102 /* harmony default export */ var post_switch_to_draft_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
11409 /* harmony default export */ var post_switch_to_draft_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
11103 var _select = select('core/editor'), |
11410 var _select = select('core/editor'), |
11104 isSavingPost = _select.isSavingPost, |
11411 isSavingPost = _select.isSavingPost, |
11131 |
11438 |
11132 |
11439 |
11133 |
11440 |
11134 |
11441 |
11135 |
11442 |
11443 function post_saved_state_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_saved_state_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
11444 |
|
11445 function post_saved_state_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
11446 |
|
11136 /** |
11447 /** |
11137 * External dependencies |
11448 * External dependencies |
11138 */ |
11449 */ |
11139 |
11450 |
11140 |
|
11141 /** |
11451 /** |
11142 * WordPress dependencies |
11452 * WordPress dependencies |
11143 */ |
11453 */ |
11144 |
11454 |
11145 |
11455 |
11147 |
11457 |
11148 |
11458 |
11149 |
11459 |
11150 |
11460 |
11151 |
11461 |
11462 |
|
11152 /** |
11463 /** |
11153 * Internal dependencies |
11464 * Internal dependencies |
11154 */ |
11465 */ |
11155 |
11466 |
11156 |
11467 |
11158 * Component showing whether the post is saved or not and displaying save links. |
11469 * Component showing whether the post is saved or not and displaying save links. |
11159 * |
11470 * |
11160 * @param {Object} Props Component Props. |
11471 * @param {Object} Props Component Props. |
11161 */ |
11472 */ |
11162 |
11473 |
11163 var post_saved_state_PostSavedState = |
11474 var post_saved_state_PostSavedState = /*#__PURE__*/function (_Component) { |
11164 /*#__PURE__*/ |
|
11165 function (_Component) { |
|
11166 Object(inherits["a" /* default */])(PostSavedState, _Component); |
11475 Object(inherits["a" /* default */])(PostSavedState, _Component); |
11476 |
|
11477 var _super = post_saved_state_createSuper(PostSavedState); |
|
11167 |
11478 |
11168 function PostSavedState() { |
11479 function PostSavedState() { |
11169 var _this; |
11480 var _this; |
11170 |
11481 |
11171 Object(classCallCheck["a" /* default */])(this, PostSavedState); |
11482 Object(classCallCheck["a" /* default */])(this, PostSavedState); |
11172 |
11483 |
11173 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostSavedState).apply(this, arguments)); |
11484 _this = _super.apply(this, arguments); |
11174 _this.state = { |
11485 _this.state = { |
11175 forceSavedMessage: false |
11486 forceSavedMessage: false |
11176 }; |
11487 }; |
11177 return _this; |
11488 return _this; |
11178 } |
11489 } |
11195 } |
11506 } |
11196 }, { |
11507 }, { |
11197 key: "render", |
11508 key: "render", |
11198 value: function render() { |
11509 value: function render() { |
11199 var _this$props = this.props, |
11510 var _this$props = this.props, |
11200 post = _this$props.post, |
11511 hasPublishAction = _this$props.hasPublishAction, |
11201 isNew = _this$props.isNew, |
11512 isNew = _this$props.isNew, |
11202 isScheduled = _this$props.isScheduled, |
11513 isScheduled = _this$props.isScheduled, |
11203 isPublished = _this$props.isPublished, |
11514 isPublished = _this$props.isPublished, |
11204 isDirty = _this$props.isDirty, |
11515 isDirty = _this$props.isDirty, |
11205 isSaving = _this$props.isSaving, |
11516 isSaving = _this$props.isSaving, |
11215 // paths of this function, including proper naming convention for |
11526 // paths of this function, including proper naming convention for |
11216 // the "Save Draft" button. |
11527 // the "Save Draft" button. |
11217 var classes = classnames_default()('editor-post-saved-state', 'is-saving', { |
11528 var classes = classnames_default()('editor-post-saved-state', 'is-saving', { |
11218 'is-autosaving': isAutosaving |
11529 'is-autosaving': isAutosaving |
11219 }); |
11530 }); |
11220 return Object(external_this_wp_element_["createElement"])("span", { |
11531 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Animate"], { |
11221 className: classes |
11532 type: "loading" |
11222 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], { |
11533 }, function (_ref) { |
11223 icon: "cloud" |
11534 var animateClassName = _ref.className; |
11224 }), isAutosaving ? Object(external_this_wp_i18n_["__"])('Autosaving') : Object(external_this_wp_i18n_["__"])('Saving')); |
11535 return Object(external_this_wp_element_["createElement"])("span", { |
11536 className: classnames_default()(classes, animateClassName) |
|
11537 }, Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
|
11538 icon: library_cloud |
|
11539 }), isAutosaving ? Object(external_this_wp_i18n_["__"])('Autosaving') : Object(external_this_wp_i18n_["__"])('Saving')); |
|
11540 }); |
|
11225 } |
11541 } |
11226 |
11542 |
11227 if (isPublished || isScheduled) { |
11543 if (isPublished || isScheduled) { |
11228 return Object(external_this_wp_element_["createElement"])(post_switch_to_draft_button, null); |
11544 return Object(external_this_wp_element_["createElement"])(post_switch_to_draft_button, null); |
11229 } |
11545 } |
11233 } |
11549 } |
11234 |
11550 |
11235 if (forceSavedMessage || !isNew && !isDirty) { |
11551 if (forceSavedMessage || !isNew && !isDirty) { |
11236 return Object(external_this_wp_element_["createElement"])("span", { |
11552 return Object(external_this_wp_element_["createElement"])("span", { |
11237 className: "editor-post-saved-state is-saved" |
11553 className: "editor-post-saved-state is-saved" |
11238 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], { |
11554 }, Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
11239 icon: "saved" |
11555 icon: library_check["a" /* default */] |
11240 }), Object(external_this_wp_i18n_["__"])('Saved')); |
11556 }), Object(external_this_wp_i18n_["__"])('Saved')); |
11241 } // Once the post has been submitted for review this button |
11557 } // Once the post has been submitted for review this button |
11242 // is not needed for the contributor role. |
11558 // is not needed for the contributor role. |
11243 |
11559 |
11244 |
11560 |
11245 var hasPublishAction = Object(external_lodash_["get"])(post, ['_links', 'wp:action-publish'], false); |
|
11246 |
|
11247 if (!hasPublishAction && isPending) { |
11561 if (!hasPublishAction && isPending) { |
11248 return null; |
11562 return null; |
11249 } |
11563 } |
11250 |
11564 |
11251 var label = isPending ? Object(external_this_wp_i18n_["__"])('Save as Pending') : Object(external_this_wp_i18n_["__"])('Save Draft'); |
11565 var label = isPending ? Object(external_this_wp_i18n_["__"])('Save as pending') : Object(external_this_wp_i18n_["__"])('Save draft'); |
11252 |
11566 |
11253 if (!isLargeViewport) { |
11567 if (!isLargeViewport) { |
11254 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
11568 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11255 className: "editor-post-save-draft", |
11569 className: "editor-post-save-draft", |
11256 label: label, |
11570 label: label, |
11257 onClick: onSave, |
11571 onClick: function onClick() { |
11572 return onSave(); |
|
11573 }, |
|
11258 shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), |
11574 shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), |
11259 icon: "cloud-upload" |
11575 icon: cloud_upload |
11260 }); |
11576 }); |
11261 } |
11577 } |
11262 |
11578 |
11263 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11579 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11264 className: "editor-post-save-draft", |
11580 className: "editor-post-save-draft", |
11265 onClick: onSave, |
11581 onClick: function onClick() { |
11582 return onSave(); |
|
11583 }, |
|
11266 shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), |
11584 shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), |
11267 isTertiary: true |
11585 isTertiary: true |
11268 }, label); |
11586 }, label); |
11269 } |
11587 } |
11270 }]); |
11588 }]); |
11271 |
11589 |
11272 return PostSavedState; |
11590 return PostSavedState; |
11273 }(external_this_wp_element_["Component"]); |
11591 }(external_this_wp_element_["Component"]); |
11274 /* harmony default export */ var post_saved_state = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) { |
11592 /* harmony default export */ var post_saved_state = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { |
11275 var forceIsDirty = _ref.forceIsDirty, |
11593 var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2; |
11276 forceIsSaving = _ref.forceIsSaving; |
11594 |
11595 var forceIsDirty = _ref2.forceIsDirty, |
|
11596 forceIsSaving = _ref2.forceIsSaving; |
|
11277 |
11597 |
11278 var _select = select('core/editor'), |
11598 var _select = select('core/editor'), |
11279 isEditedPostNew = _select.isEditedPostNew, |
11599 isEditedPostNew = _select.isEditedPostNew, |
11280 isCurrentPostPublished = _select.isCurrentPostPublished, |
11600 isCurrentPostPublished = _select.isCurrentPostPublished, |
11281 isCurrentPostScheduled = _select.isCurrentPostScheduled, |
11601 isCurrentPostScheduled = _select.isCurrentPostScheduled, |
11285 getCurrentPost = _select.getCurrentPost, |
11605 getCurrentPost = _select.getCurrentPost, |
11286 isAutosavingPost = _select.isAutosavingPost, |
11606 isAutosavingPost = _select.isAutosavingPost, |
11287 getEditedPostAttribute = _select.getEditedPostAttribute; |
11607 getEditedPostAttribute = _select.getEditedPostAttribute; |
11288 |
11608 |
11289 return { |
11609 return { |
11290 post: getCurrentPost(), |
11610 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, |
11291 isNew: isEditedPostNew(), |
11611 isNew: isEditedPostNew(), |
11292 isPublished: isCurrentPostPublished(), |
11612 isPublished: isCurrentPostPublished(), |
11293 isScheduled: isCurrentPostScheduled(), |
11613 isScheduled: isCurrentPostScheduled(), |
11294 isDirty: forceIsDirty || isEditedPostDirty(), |
11614 isDirty: forceIsDirty || isEditedPostDirty(), |
11295 isSaving: forceIsSaving || isSavingPost(), |
11615 isSaving: forceIsSaving || isSavingPost(), |
11300 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
11620 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
11301 return { |
11621 return { |
11302 onSave: dispatch('core/editor').savePost |
11622 onSave: dispatch('core/editor').savePost |
11303 }; |
11623 }; |
11304 }), external_this_wp_compose_["withSafeTimeout"], Object(external_this_wp_viewport_["withViewportMatch"])({ |
11624 }), external_this_wp_compose_["withSafeTimeout"], Object(external_this_wp_viewport_["withViewportMatch"])({ |
11305 isLargeViewport: 'medium' |
11625 isLargeViewport: 'small' |
11306 })])(post_saved_state_PostSavedState)); |
11626 })])(post_saved_state_PostSavedState)); |
11307 |
11627 |
11308 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js |
11628 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js |
11309 /** |
11629 /** |
11310 * External dependencies |
11630 * External dependencies |
11330 var _select = select('core/editor'), |
11650 var _select = select('core/editor'), |
11331 getCurrentPost = _select.getCurrentPost, |
11651 getCurrentPost = _select.getCurrentPost, |
11332 getCurrentPostType = _select.getCurrentPostType; |
11652 getCurrentPostType = _select.getCurrentPostType; |
11333 |
11653 |
11334 return { |
11654 return { |
11335 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
11655 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
11336 postType: getCurrentPostType() |
11656 postType: getCurrentPostType() |
11337 }; |
11657 }; |
11338 })])(PostScheduleCheck)); |
11658 })])(PostScheduleCheck)); |
11659 |
|
11660 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js |
|
11661 |
|
11662 |
|
11663 /** |
|
11664 * Internal dependencies |
|
11665 */ |
|
11666 |
|
11667 function PostSlugCheck(_ref) { |
|
11668 var children = _ref.children; |
|
11669 return Object(external_this_wp_element_["createElement"])(post_type_support_check, { |
|
11670 supportKeys: "slug" |
|
11671 }, children); |
|
11672 } |
|
11673 |
|
11674 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js |
|
11675 |
|
11676 |
|
11677 |
|
11678 |
|
11679 |
|
11680 |
|
11681 |
|
11682 |
|
11683 function post_slug_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_slug_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
11684 |
|
11685 function post_slug_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
11686 |
|
11687 /** |
|
11688 * WordPress dependencies |
|
11689 */ |
|
11690 |
|
11691 |
|
11692 |
|
11693 |
|
11694 |
|
11695 /** |
|
11696 * Internal dependencies |
|
11697 */ |
|
11698 |
|
11699 |
|
11700 |
|
11701 var post_slug_PostSlug = /*#__PURE__*/function (_Component) { |
|
11702 Object(inherits["a" /* default */])(PostSlug, _Component); |
|
11703 |
|
11704 var _super = post_slug_createSuper(PostSlug); |
|
11705 |
|
11706 function PostSlug(_ref) { |
|
11707 var _this; |
|
11708 |
|
11709 var postSlug = _ref.postSlug, |
|
11710 postTitle = _ref.postTitle, |
|
11711 postID = _ref.postID; |
|
11712 |
|
11713 Object(classCallCheck["a" /* default */])(this, PostSlug); |
|
11714 |
|
11715 _this = _super.apply(this, arguments); |
|
11716 _this.state = { |
|
11717 editedSlug: Object(external_this_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID |
|
11718 }; |
|
11719 _this.setSlug = _this.setSlug.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
11720 return _this; |
|
11721 } |
|
11722 |
|
11723 Object(createClass["a" /* default */])(PostSlug, [{ |
|
11724 key: "setSlug", |
|
11725 value: function setSlug(event) { |
|
11726 var _this$props = this.props, |
|
11727 postSlug = _this$props.postSlug, |
|
11728 onUpdateSlug = _this$props.onUpdateSlug; |
|
11729 var value = event.target.value; |
|
11730 var editedSlug = cleanForSlug(value); |
|
11731 |
|
11732 if (editedSlug === postSlug) { |
|
11733 return; |
|
11734 } |
|
11735 |
|
11736 onUpdateSlug(editedSlug); |
|
11737 } |
|
11738 }, { |
|
11739 key: "render", |
|
11740 value: function render() { |
|
11741 var _this2 = this; |
|
11742 |
|
11743 var instanceId = this.props.instanceId; |
|
11744 var editedSlug = this.state.editedSlug; |
|
11745 var inputId = 'editor-post-slug-' + instanceId; |
|
11746 return Object(external_this_wp_element_["createElement"])(PostSlugCheck, null, Object(external_this_wp_element_["createElement"])("label", { |
|
11747 htmlFor: inputId |
|
11748 }, Object(external_this_wp_i18n_["__"])('Slug')), Object(external_this_wp_element_["createElement"])("input", { |
|
11749 type: "text", |
|
11750 id: inputId, |
|
11751 value: editedSlug, |
|
11752 onChange: function onChange(event) { |
|
11753 return _this2.setState({ |
|
11754 editedSlug: event.target.value |
|
11755 }); |
|
11756 }, |
|
11757 onBlur: this.setSlug, |
|
11758 className: "editor-post-slug__input" |
|
11759 })); |
|
11760 } |
|
11761 }]); |
|
11762 |
|
11763 return PostSlug; |
|
11764 }(external_this_wp_element_["Component"]); |
|
11765 /* harmony default export */ var post_slug = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
|
11766 var _select = select('core/editor'), |
|
11767 getCurrentPost = _select.getCurrentPost, |
|
11768 getEditedPostAttribute = _select.getEditedPostAttribute; |
|
11769 |
|
11770 var _getCurrentPost = getCurrentPost(), |
|
11771 id = _getCurrentPost.id; |
|
11772 |
|
11773 return { |
|
11774 postSlug: getEditedPostAttribute('slug'), |
|
11775 postTitle: getEditedPostAttribute('title'), |
|
11776 postID: id |
|
11777 }; |
|
11778 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
|
11779 var _dispatch = dispatch('core/editor'), |
|
11780 editPost = _dispatch.editPost; |
|
11781 |
|
11782 return { |
|
11783 onUpdateSlug: function onUpdateSlug(slug) { |
|
11784 editPost({ |
|
11785 slug: slug |
|
11786 }); |
|
11787 } |
|
11788 }; |
|
11789 }), external_this_wp_compose_["withInstanceId"]])(post_slug_PostSlug)); |
|
11339 |
11790 |
11340 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js |
11791 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js |
11341 /** |
11792 /** |
11342 * External dependencies |
11793 * External dependencies |
11343 */ |
11794 */ |
11360 return children; |
11811 return children; |
11361 } |
11812 } |
11362 /* harmony default export */ var post_sticky_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
11813 /* harmony default export */ var post_sticky_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
11363 var post = select('core/editor').getCurrentPost(); |
11814 var post = select('core/editor').getCurrentPost(); |
11364 return { |
11815 return { |
11365 hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false), |
11816 hasStickyAction: Object(external_this_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false), |
11366 postType: select('core/editor').getCurrentPostType() |
11817 postType: select('core/editor').getCurrentPostType() |
11367 }; |
11818 }; |
11368 })])(PostStickyCheck)); |
11819 })])(PostStickyCheck)); |
11369 |
11820 |
11370 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js |
11821 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js |
11417 |
11868 |
11418 |
11869 |
11419 |
11870 |
11420 |
11871 |
11421 |
11872 |
11873 function hierarchical_term_selector_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
11874 |
|
11875 function hierarchical_term_selector_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { hierarchical_term_selector_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { hierarchical_term_selector_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
11876 |
|
11877 function hierarchical_term_selector_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hierarchical_term_selector_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
11878 |
|
11879 function hierarchical_term_selector_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
11422 |
11880 |
11423 /** |
11881 /** |
11424 * External dependencies |
11882 * External dependencies |
11425 */ |
11883 */ |
11426 |
11884 |
11450 order: 'asc', |
11908 order: 'asc', |
11451 _fields: 'id,name,parent' |
11909 _fields: 'id,name,parent' |
11452 }; |
11910 }; |
11453 var MIN_TERMS_COUNT_FOR_FILTER = 8; |
11911 var MIN_TERMS_COUNT_FOR_FILTER = 8; |
11454 |
11912 |
11455 var hierarchical_term_selector_HierarchicalTermSelector = |
11913 var hierarchical_term_selector_HierarchicalTermSelector = /*#__PURE__*/function (_Component) { |
11456 /*#__PURE__*/ |
|
11457 function (_Component) { |
|
11458 Object(inherits["a" /* default */])(HierarchicalTermSelector, _Component); |
11914 Object(inherits["a" /* default */])(HierarchicalTermSelector, _Component); |
11915 |
|
11916 var _super = hierarchical_term_selector_createSuper(HierarchicalTermSelector); |
|
11459 |
11917 |
11460 function HierarchicalTermSelector() { |
11918 function HierarchicalTermSelector() { |
11461 var _this; |
11919 var _this; |
11462 |
11920 |
11463 Object(classCallCheck["a" /* default */])(this, HierarchicalTermSelector); |
11921 Object(classCallCheck["a" /* default */])(this, HierarchicalTermSelector); |
11464 |
11922 |
11465 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(HierarchicalTermSelector).apply(this, arguments)); |
11923 _this = _super.apply(this, arguments); |
11466 _this.findTerm = _this.findTerm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11924 _this.findTerm = _this.findTerm.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11467 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11925 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11468 _this.onChangeFormName = _this.onChangeFormName.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11926 _this.onChangeFormName = _this.onChangeFormName.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11469 _this.onChangeFormParent = _this.onChangeFormParent.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11927 _this.onChangeFormParent = _this.onChangeFormParent.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11470 _this.onAddTerm = _this.onAddTerm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11928 _this.onAddTerm = _this.onAddTerm.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11471 _this.onToggleForm = _this.onToggleForm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11929 _this.onToggleForm = _this.onToggleForm.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11472 _this.setFilterValue = _this.setFilterValue.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11930 _this.setFilterValue = _this.setFilterValue.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11473 _this.sortBySelected = _this.sortBySelected.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
11931 _this.sortBySelected = _this.sortBySelected.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
11474 _this.state = { |
11932 _this.state = { |
11475 loading: true, |
11933 loading: true, |
11476 availableTermsTree: [], |
11934 availableTermsTree: [], |
11477 availableTerms: [], |
11935 availableTerms: [], |
11478 adding: false, |
11936 adding: false, |
11485 return _this; |
11943 return _this; |
11486 } |
11944 } |
11487 |
11945 |
11488 Object(createClass["a" /* default */])(HierarchicalTermSelector, [{ |
11946 Object(createClass["a" /* default */])(HierarchicalTermSelector, [{ |
11489 key: "onChange", |
11947 key: "onChange", |
11490 value: function onChange(event) { |
11948 value: function onChange(termId) { |
11491 var _this$props = this.props, |
11949 var _this$props = this.props, |
11492 onUpdateTerms = _this$props.onUpdateTerms, |
11950 onUpdateTerms = _this$props.onUpdateTerms, |
11493 _this$props$terms = _this$props.terms, |
11951 _this$props$terms = _this$props.terms, |
11494 terms = _this$props$terms === void 0 ? [] : _this$props$terms, |
11952 terms = _this$props$terms === void 0 ? [] : _this$props$terms, |
11495 taxonomy = _this$props.taxonomy; |
11953 taxonomy = _this$props.taxonomy; |
11496 var termId = parseInt(event.target.value, 10); |
|
11497 var hasTerm = terms.indexOf(termId) !== -1; |
11954 var hasTerm = terms.indexOf(termId) !== -1; |
11498 var newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [].concat(Object(toConsumableArray["a" /* default */])(terms), [termId]); |
11955 var newTerms = hasTerm ? Object(external_this_lodash_["without"])(terms, termId) : [].concat(Object(toConsumableArray["a" /* default */])(terms), [termId]); |
11499 onUpdateTerms(newTerms, taxonomy.rest_base); |
11956 onUpdateTerms(newTerms, taxonomy.rest_base); |
11500 } |
11957 } |
11501 }, { |
11958 }, { |
11502 key: "onChangeFormName", |
11959 key: "onChangeFormName", |
11503 value: function onChangeFormName(event) { |
11960 value: function onChangeFormName(event) { |
11523 }); |
11980 }); |
11524 } |
11981 } |
11525 }, { |
11982 }, { |
11526 key: "findTerm", |
11983 key: "findTerm", |
11527 value: function findTerm(terms, parent, name) { |
11984 value: function findTerm(terms, parent, name) { |
11528 return Object(external_lodash_["find"])(terms, function (term) { |
11985 return Object(external_this_lodash_["find"])(terms, function (term) { |
11529 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); |
11986 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); |
11530 }); |
11987 }); |
11531 } |
11988 } |
11532 }, { |
11989 }, { |
11533 key: "onAddTerm", |
11990 key: "onAddTerm", |
11553 |
12010 |
11554 var existingTerm = this.findTerm(availableTerms, formParent, formName); |
12011 var existingTerm = this.findTerm(availableTerms, formParent, formName); |
11555 |
12012 |
11556 if (existingTerm) { |
12013 if (existingTerm) { |
11557 // if the term we are adding exists but is not selected select it |
12014 // if the term we are adding exists but is not selected select it |
11558 if (!Object(external_lodash_["some"])(terms, function (term) { |
12015 if (!Object(external_this_lodash_["some"])(terms, function (term) { |
11559 return term === existingTerm.id; |
12016 return term === existingTerm.id; |
11560 })) { |
12017 })) { |
11561 onUpdateTerms([].concat(Object(toConsumableArray["a" /* default */])(terms), [existingTerm.id]), taxonomy.rest_base); |
12018 onUpdateTerms([].concat(Object(toConsumableArray["a" /* default */])(terms), [existingTerm.id]), taxonomy.rest_base); |
11562 } |
12019 } |
11563 |
12020 |
11584 var errorCode = error.code; |
12041 var errorCode = error.code; |
11585 |
12042 |
11586 if (errorCode === 'term_exists') { |
12043 if (errorCode === 'term_exists') { |
11587 // search the new category created since last fetch |
12044 // search the new category created since last fetch |
11588 _this2.addRequest = external_this_wp_apiFetch_default()({ |
12045 _this2.addRequest = external_this_wp_apiFetch_default()({ |
11589 path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, hierarchical_term_selector_DEFAULT_QUERY, { |
12046 path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), hierarchical_term_selector_objectSpread({}, hierarchical_term_selector_DEFAULT_QUERY, { |
11590 parent: formParent || 0, |
12047 parent: formParent || 0, |
11591 search: formName |
12048 search: formName |
11592 })) |
12049 })) |
11593 }); |
12050 }); |
11594 return _this2.addRequest.then(function (searchResult) { |
12051 return _this2.addRequest.then(function (searchResult) { |
11597 } |
12054 } |
11598 |
12055 |
11599 return Promise.reject(error); |
12056 return Promise.reject(error); |
11600 }); |
12057 }); |
11601 findOrCreatePromise.then(function (term) { |
12058 findOrCreatePromise.then(function (term) { |
11602 var hasTerm = !!Object(external_lodash_["find"])(_this2.state.availableTerms, function (availableTerm) { |
12059 var hasTerm = !!Object(external_this_lodash_["find"])(_this2.state.availableTerms, function (availableTerm) { |
11603 return availableTerm.id === term.id; |
12060 return availableTerm.id === term.id; |
11604 }); |
12061 }); |
11605 var newAvailableTerms = hasTerm ? _this2.state.availableTerms : [term].concat(Object(toConsumableArray["a" /* default */])(_this2.state.availableTerms)); |
12062 var newAvailableTerms = hasTerm ? _this2.state.availableTerms : [term].concat(Object(toConsumableArray["a" /* default */])(_this2.state.availableTerms)); |
11606 var termAddedMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(_this2.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Category') : Object(external_this_wp_i18n_["__"])('Term'))); |
12063 var termAddedMessage = Object(external_this_wp_i18n_["sprintf"])( |
12064 /* translators: %s: taxonomy name */ |
|
12065 Object(external_this_wp_i18n_["_x"])('%s added', 'term'), Object(external_this_lodash_["get"])(_this2.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Category') : Object(external_this_wp_i18n_["__"])('Term'))); |
|
11607 |
12066 |
11608 _this2.props.speak(termAddedMessage, 'assertive'); |
12067 _this2.props.speak(termAddedMessage, 'assertive'); |
11609 |
12068 |
11610 _this2.addRequest = null; |
12069 _this2.addRequest = null; |
11611 |
12070 |
11636 this.fetchTerms(); |
12095 this.fetchTerms(); |
11637 } |
12096 } |
11638 }, { |
12097 }, { |
11639 key: "componentWillUnmount", |
12098 key: "componentWillUnmount", |
11640 value: function componentWillUnmount() { |
12099 value: function componentWillUnmount() { |
11641 Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']); |
12100 Object(external_this_lodash_["invoke"])(this.fetchRequest, ['abort']); |
11642 Object(external_lodash_["invoke"])(this.addRequest, ['abort']); |
12101 Object(external_this_lodash_["invoke"])(this.addRequest, ['abort']); |
11643 } |
12102 } |
11644 }, { |
12103 }, { |
11645 key: "componentDidUpdate", |
12104 key: "componentDidUpdate", |
11646 value: function componentDidUpdate(prevProps) { |
12105 value: function componentDidUpdate(prevProps) { |
11647 if (this.props.taxonomy !== prevProps.taxonomy) { |
12106 if (this.props.taxonomy !== prevProps.taxonomy) { |
11759 this.setState({ |
12218 this.setState({ |
11760 filterValue: filterValue, |
12219 filterValue: filterValue, |
11761 filteredTermsTree: filteredTermsTree |
12220 filteredTermsTree: filteredTermsTree |
11762 }); |
12221 }); |
11763 var resultCount = getResultCount(filteredTermsTree); |
12222 var resultCount = getResultCount(filteredTermsTree); |
11764 var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); |
12223 var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])( |
12224 /* translators: %d: number of results */ |
|
12225 Object(external_this_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); |
|
11765 this.props.debouncedSpeak(resultsFoundMessage, 'assertive'); |
12226 this.props.debouncedSpeak(resultsFoundMessage, 'assertive'); |
11766 } |
12227 } |
11767 }, { |
12228 }, { |
11768 key: "getFilterMatcher", |
12229 key: "getFilterMatcher", |
11769 value: function getFilterMatcher(filterValue) { |
12230 value: function getFilterMatcher(filterValue) { |
11772 return originalTerm; |
12233 return originalTerm; |
11773 } // Shallow clone, because we'll be filtering the term's children and |
12234 } // Shallow clone, because we'll be filtering the term's children and |
11774 // don't want to modify the original term. |
12235 // don't want to modify the original term. |
11775 |
12236 |
11776 |
12237 |
11777 var term = Object(objectSpread["a" /* default */])({}, originalTerm); // Map and filter the children, recursive so we deal with grandchildren |
12238 var term = hierarchical_term_selector_objectSpread({}, originalTerm); // Map and filter the children, recursive so we deal with grandchildren |
11778 // and any deeper levels. |
12239 // and any deeper levels. |
11779 |
12240 |
11780 |
12241 |
11781 if (term.children.length > 0) { |
12242 if (term.children.length > 0) { |
11782 term.children = term.children.map(matchTermsForFilter).filter(function (child) { |
12243 term.children = term.children.map(matchTermsForFilter).filter(function (child) { |
11784 }); |
12245 }); |
11785 } // If the term's name contains the filterValue, or it has children |
12246 } // If the term's name contains the filterValue, or it has children |
11786 // (i.e. some child matched at some point in the tree) then return it. |
12247 // (i.e. some child matched at some point in the tree) then return it. |
11787 |
12248 |
11788 |
12249 |
11789 if (-1 !== term.name.toLowerCase().indexOf(filterValue) || term.children.length > 0) { |
12250 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { |
11790 return term; |
12251 return term; |
11791 } // Otherwise, return false. After mapping, the list of terms will need |
12252 } // Otherwise, return false. After mapping, the list of terms will need |
11792 // to have false values filtered out. |
12253 // to have false values filtered out. |
11793 |
12254 |
11794 |
12255 |
11803 var _this4 = this; |
12264 var _this4 = this; |
11804 |
12265 |
11805 var _this$props$terms2 = this.props.terms, |
12266 var _this$props$terms2 = this.props.terms, |
11806 terms = _this$props$terms2 === void 0 ? [] : _this$props$terms2; |
12267 terms = _this$props$terms2 === void 0 ? [] : _this$props$terms2; |
11807 return renderedTerms.map(function (term) { |
12268 return renderedTerms.map(function (term) { |
11808 var id = "editor-post-taxonomies-hierarchical-term-".concat(term.id); |
|
11809 return Object(external_this_wp_element_["createElement"])("div", { |
12269 return Object(external_this_wp_element_["createElement"])("div", { |
11810 key: term.id, |
12270 key: term.id, |
11811 className: "editor-post-taxonomies__hierarchical-terms-choice" |
12271 className: "editor-post-taxonomies__hierarchical-terms-choice" |
11812 }, Object(external_this_wp_element_["createElement"])("input", { |
12272 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { |
11813 id: id, |
|
11814 className: "editor-post-taxonomies__hierarchical-terms-input", |
|
11815 type: "checkbox", |
|
11816 checked: terms.indexOf(term.id) !== -1, |
12273 checked: terms.indexOf(term.id) !== -1, |
11817 value: term.id, |
12274 onChange: function onChange() { |
11818 onChange: _this4.onChange |
12275 var termId = parseInt(term.id, 10); |
11819 }), Object(external_this_wp_element_["createElement"])("label", { |
12276 |
11820 htmlFor: id |
12277 _this4.onChange(termId); |
11821 }, Object(external_lodash_["unescape"])(term.name)), !!term.children.length && Object(external_this_wp_element_["createElement"])("div", { |
12278 }, |
12279 label: Object(external_this_lodash_["unescape"])(term.name) |
|
12280 }), !!term.children.length && Object(external_this_wp_element_["createElement"])("div", { |
|
11822 className: "editor-post-taxonomies__hierarchical-terms-subchoices" |
12281 className: "editor-post-taxonomies__hierarchical-terms-subchoices" |
11823 }, _this4.renderTerms(term.children))); |
12282 }, _this4.renderTerms(term.children))); |
11824 }); |
12283 }); |
11825 } |
12284 } |
11826 }, { |
12285 }, { |
11846 loading = _this$state2.loading, |
12305 loading = _this$state2.loading, |
11847 showForm = _this$state2.showForm, |
12306 showForm = _this$state2.showForm, |
11848 filterValue = _this$state2.filterValue; |
12307 filterValue = _this$state2.filterValue; |
11849 |
12308 |
11850 var labelWithFallback = function labelWithFallback(labelProperty, fallbackIsCategory, fallbackIsNotCategory) { |
12309 var labelWithFallback = function labelWithFallback(labelProperty, fallbackIsCategory, fallbackIsNotCategory) { |
11851 return Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); |
12310 return Object(external_this_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); |
11852 }; |
12311 }; |
11853 |
12312 |
11854 var newTermButtonLabel = labelWithFallback('add_new_item', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term')); |
12313 var newTermButtonLabel = labelWithFallback('add_new_item', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term')); |
11855 var newTermLabel = labelWithFallback('new_item_name', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term')); |
12314 var newTermLabel = labelWithFallback('new_item_name', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term')); |
11856 var parentSelectLabel = labelWithFallback('parent_item', Object(external_this_wp_i18n_["__"])('Parent Category'), Object(external_this_wp_i18n_["__"])('Parent Term')); |
12315 var parentSelectLabel = labelWithFallback('parent_item', Object(external_this_wp_i18n_["__"])('Parent Category'), Object(external_this_wp_i18n_["__"])('Parent Term')); |
11857 var noParentOption = "\u2014 ".concat(parentSelectLabel, " \u2014"); |
12316 var noParentOption = "\u2014 ".concat(parentSelectLabel, " \u2014"); |
11858 var newTermSubmitLabel = newTermButtonLabel; |
12317 var newTermSubmitLabel = newTermButtonLabel; |
11859 var inputId = "editor-post-taxonomies__hierarchical-terms-input-".concat(instanceId); |
12318 var inputId = "editor-post-taxonomies__hierarchical-terms-input-".concat(instanceId); |
11860 var filterInputId = "editor-post-taxonomies__hierarchical-terms-filter-".concat(instanceId); |
12319 var filterInputId = "editor-post-taxonomies__hierarchical-terms-filter-".concat(instanceId); |
11861 var filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_this_wp_i18n_["__"])('Search Terms')); |
12320 var filterLabel = Object(external_this_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_this_wp_i18n_["__"])('Search Terms')); |
11862 var groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_this_wp_i18n_["__"])('Terms')); |
12321 var groupLabel = Object(external_this_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_this_wp_i18n_["__"])('Terms')); |
11863 var showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; |
12322 var showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; |
11864 return [showFilter && Object(external_this_wp_element_["createElement"])("label", { |
12323 return [showFilter && Object(external_this_wp_element_["createElement"])("label", { |
11865 key: "filter-label", |
12324 key: "filter-label", |
11866 htmlFor: filterInputId |
12325 htmlFor: filterInputId |
11867 }, filterLabel), showFilter && Object(external_this_wp_element_["createElement"])("input", { |
12326 }, filterLabel), showFilter && Object(external_this_wp_element_["createElement"])("input", { |
11901 noOptionLabel: noParentOption, |
12360 noOptionLabel: noParentOption, |
11902 onChange: this.onChangeFormParent, |
12361 onChange: this.onChangeFormParent, |
11903 selectedId: formParent, |
12362 selectedId: formParent, |
11904 tree: availableTermsTree |
12363 tree: availableTermsTree |
11905 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
12364 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
11906 isDefault: true, |
12365 isSecondary: true, |
11907 type: "submit", |
12366 type: "submit", |
11908 className: "editor-post-taxonomies__hierarchical-terms-submit" |
12367 className: "editor-post-taxonomies__hierarchical-terms-submit" |
11909 }, newTermSubmitLabel))]; |
12368 }, newTermSubmitLabel))]; |
11910 /* eslint-enable jsx-a11y/no-onchange */ |
|
11911 } |
12369 } |
11912 }]); |
12370 }]); |
11913 |
12371 |
11914 return HierarchicalTermSelector; |
12372 return HierarchicalTermSelector; |
11915 }(external_this_wp_element_["Component"]); |
12373 }(external_this_wp_element_["Component"]); |
11923 var _select2 = select('core'), |
12381 var _select2 = select('core'), |
11924 getTaxonomy = _select2.getTaxonomy; |
12382 getTaxonomy = _select2.getTaxonomy; |
11925 |
12383 |
11926 var taxonomy = getTaxonomy(slug); |
12384 var taxonomy = getTaxonomy(slug); |
11927 return { |
12385 return { |
11928 hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, |
12386 hasCreateAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, |
11929 hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, |
12387 hasAssignAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, |
11930 terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], |
12388 terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], |
11931 taxonomy: taxonomy |
12389 taxonomy: taxonomy |
11932 }; |
12390 }; |
11933 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
12391 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
11934 return { |
12392 return { |
11960 |
12418 |
11961 function PostTaxonomies(_ref) { |
12419 function PostTaxonomies(_ref) { |
11962 var postType = _ref.postType, |
12420 var postType = _ref.postType, |
11963 taxonomies = _ref.taxonomies, |
12421 taxonomies = _ref.taxonomies, |
11964 _ref$taxonomyWrapper = _ref.taxonomyWrapper, |
12422 _ref$taxonomyWrapper = _ref.taxonomyWrapper, |
11965 taxonomyWrapper = _ref$taxonomyWrapper === void 0 ? external_lodash_["identity"] : _ref$taxonomyWrapper; |
12423 taxonomyWrapper = _ref$taxonomyWrapper === void 0 ? external_this_lodash_["identity"] : _ref$taxonomyWrapper; |
11966 var availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, function (taxonomy) { |
12424 var availableTaxonomies = Object(external_this_lodash_["filter"])(taxonomies, function (taxonomy) { |
11967 return Object(external_lodash_["includes"])(taxonomy.types, postType); |
12425 return Object(external_this_lodash_["includes"])(taxonomy.types, postType); |
11968 }); |
12426 }); |
11969 var visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, function (taxonomy) { |
12427 var visibleTaxonomies = Object(external_this_lodash_["filter"])(availableTaxonomies, function (taxonomy) { |
11970 return taxonomy.visibility.show_ui; |
12428 return taxonomy.visibility.show_ui; |
11971 }); |
12429 }); |
11972 return visibleTaxonomies.map(function (taxonomy) { |
12430 return visibleTaxonomies.map(function (taxonomy) { |
11973 var TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; |
12431 var TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; |
11974 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], { |
12432 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], { |
12000 |
12458 |
12001 function PostTaxonomiesCheck(_ref) { |
12459 function PostTaxonomiesCheck(_ref) { |
12002 var postType = _ref.postType, |
12460 var postType = _ref.postType, |
12003 taxonomies = _ref.taxonomies, |
12461 taxonomies = _ref.taxonomies, |
12004 children = _ref.children; |
12462 children = _ref.children; |
12005 var hasTaxonomies = Object(external_lodash_["some"])(taxonomies, function (taxonomy) { |
12463 var hasTaxonomies = Object(external_this_lodash_["some"])(taxonomies, function (taxonomy) { |
12006 return Object(external_lodash_["includes"])(taxonomy.types, postType); |
12464 return Object(external_this_lodash_["includes"])(taxonomy.types, postType); |
12007 }); |
12465 }); |
12008 |
12466 |
12009 if (!hasTaxonomies) { |
12467 if (!hasTaxonomies) { |
12010 return null; |
12468 return null; |
12011 } |
12469 } |
12020 }) |
12478 }) |
12021 }; |
12479 }; |
12022 })])(PostTaxonomiesCheck)); |
12480 })])(PostTaxonomiesCheck)); |
12023 |
12481 |
12024 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js |
12482 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js |
12025 var react_autosize_textarea_lib = __webpack_require__(61); |
12483 var lib = __webpack_require__(97); |
12026 var react_autosize_textarea_lib_default = /*#__PURE__*/__webpack_require__.n(react_autosize_textarea_lib); |
12484 var lib_default = /*#__PURE__*/__webpack_require__.n(lib); |
12027 |
12485 |
12028 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js |
12486 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js |
12029 |
12487 |
12030 |
12488 |
12031 |
12489 |
12032 |
12490 |
12033 |
12491 |
12034 |
12492 |
12035 |
12493 |
12036 |
12494 |
12495 function post_text_editor_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_text_editor_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
12496 |
|
12497 function post_text_editor_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
12498 |
|
12037 /** |
12499 /** |
12038 * External dependencies |
12500 * External dependencies |
12039 */ |
12501 */ |
12040 |
12502 |
12041 /** |
12503 /** |
12045 |
12507 |
12046 |
12508 |
12047 |
12509 |
12048 |
12510 |
12049 |
12511 |
12050 var post_text_editor_PostTextEditor = |
12512 |
12051 /*#__PURE__*/ |
12513 var post_text_editor_PostTextEditor = /*#__PURE__*/function (_Component) { |
12052 function (_Component) { |
|
12053 Object(inherits["a" /* default */])(PostTextEditor, _Component); |
12514 Object(inherits["a" /* default */])(PostTextEditor, _Component); |
12515 |
|
12516 var _super = post_text_editor_createSuper(PostTextEditor); |
|
12054 |
12517 |
12055 function PostTextEditor() { |
12518 function PostTextEditor() { |
12056 var _this; |
12519 var _this; |
12057 |
12520 |
12058 Object(classCallCheck["a" /* default */])(this, PostTextEditor); |
12521 Object(classCallCheck["a" /* default */])(this, PostTextEditor); |
12059 |
12522 |
12060 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostTextEditor).apply(this, arguments)); |
12523 _this = _super.apply(this, arguments); |
12061 _this.edit = _this.edit.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12524 _this.edit = _this.edit.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12062 _this.stopEditing = _this.stopEditing.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12525 _this.stopEditing = _this.stopEditing.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12063 _this.state = {}; |
12526 _this.state = {}; |
12064 return _this; |
12527 return _this; |
12065 } |
12528 } |
12066 |
12529 |
12067 Object(createClass["a" /* default */])(PostTextEditor, [{ |
12530 Object(createClass["a" /* default */])(PostTextEditor, [{ |
12105 }, { |
12568 }, { |
12106 key: "render", |
12569 key: "render", |
12107 value: function render() { |
12570 value: function render() { |
12108 var value = this.state.value; |
12571 var value = this.state.value; |
12109 var instanceId = this.props.instanceId; |
12572 var instanceId = this.props.instanceId; |
12110 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("label", { |
12573 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { |
12111 htmlFor: "post-content-".concat(instanceId), |
12574 as: "label", |
12112 className: "screen-reader-text" |
12575 htmlFor: "post-content-".concat(instanceId) |
12113 }, Object(external_this_wp_i18n_["__"])('Type text or HTML')), Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, { |
12576 }, Object(external_this_wp_i18n_["__"])('Type text or HTML')), Object(external_this_wp_element_["createElement"])(lib_default.a, { |
12114 autoComplete: "off", |
12577 autoComplete: "off", |
12115 dir: "auto", |
12578 dir: "auto", |
12116 value: value, |
12579 value: value, |
12117 onChange: this.edit, |
12580 onChange: this.edit, |
12118 onBlur: this.stopEditing, |
12581 onBlur: this.stopEditing, |
12160 resetEditorBlocks(blocks); |
12623 resetEditorBlocks(blocks); |
12161 } |
12624 } |
12162 }; |
12625 }; |
12163 }), external_this_wp_compose_["withInstanceId"]])(post_text_editor_PostTextEditor)); |
12626 }), external_this_wp_compose_["withInstanceId"]])(post_text_editor_PostTextEditor)); |
12164 |
12627 |
12165 // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} |
12628 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js |
12166 var external_this_wp_htmlEntities_ = __webpack_require__(57); |
12629 |
12167 |
12630 |
12168 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-permalink/editor.js |
12631 |
12169 |
12632 |
12170 |
12633 |
12171 |
12634 |
12172 |
12635 |
12173 |
12636 |
12174 |
12637 |
12638 function post_title_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_title_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
12639 |
|
12640 function post_title_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
12641 |
|
12642 /** |
|
12643 * External dependencies |
|
12644 */ |
|
12175 |
12645 |
12176 |
12646 |
12177 /** |
12647 /** |
12178 * WordPress dependencies |
12648 * WordPress dependencies |
12179 */ |
12649 */ |
12180 |
12650 |
12181 |
12651 |
12182 |
12652 |
12183 |
12653 |
12184 |
12654 |
12655 |
|
12656 |
|
12657 |
|
12658 |
|
12185 /** |
12659 /** |
12186 * Internal dependencies |
12660 * Internal dependencies |
12187 */ |
12661 */ |
12188 |
12662 |
12189 |
12663 |
12190 |
|
12191 var editor_PostPermalinkEditor = |
|
12192 /*#__PURE__*/ |
|
12193 function (_Component) { |
|
12194 Object(inherits["a" /* default */])(PostPermalinkEditor, _Component); |
|
12195 |
|
12196 function PostPermalinkEditor(_ref) { |
|
12197 var _this; |
|
12198 |
|
12199 var permalinkParts = _ref.permalinkParts, |
|
12200 slug = _ref.slug; |
|
12201 |
|
12202 Object(classCallCheck["a" /* default */])(this, PostPermalinkEditor); |
|
12203 |
|
12204 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPermalinkEditor).apply(this, arguments)); |
|
12205 _this.state = { |
|
12206 editedPostName: slug || permalinkParts.postName |
|
12207 }; |
|
12208 _this.onSavePermalink = _this.onSavePermalink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
12209 return _this; |
|
12210 } |
|
12211 |
|
12212 Object(createClass["a" /* default */])(PostPermalinkEditor, [{ |
|
12213 key: "onSavePermalink", |
|
12214 value: function onSavePermalink(event) { |
|
12215 var postName = cleanForSlug(this.state.editedPostName); |
|
12216 event.preventDefault(); |
|
12217 this.props.onSave(); |
|
12218 |
|
12219 if (postName === this.props.postName) { |
|
12220 return; |
|
12221 } |
|
12222 |
|
12223 this.props.editPost({ |
|
12224 slug: postName |
|
12225 }); |
|
12226 this.setState({ |
|
12227 editedPostName: postName |
|
12228 }); |
|
12229 } |
|
12230 }, { |
|
12231 key: "render", |
|
12232 value: function render() { |
|
12233 var _this2 = this; |
|
12234 |
|
12235 var _this$props$permalink = this.props.permalinkParts, |
|
12236 prefix = _this$props$permalink.prefix, |
|
12237 suffix = _this$props$permalink.suffix; |
|
12238 var editedPostName = this.state.editedPostName; |
|
12239 /* eslint-disable jsx-a11y/no-autofocus */ |
|
12240 // Autofocus is allowed here, as this mini-UI is only loaded when the user clicks to open it. |
|
12241 |
|
12242 return Object(external_this_wp_element_["createElement"])("form", { |
|
12243 className: "editor-post-permalink-editor", |
|
12244 onSubmit: this.onSavePermalink |
|
12245 }, Object(external_this_wp_element_["createElement"])("span", { |
|
12246 className: "editor-post-permalink__editor-container" |
|
12247 }, Object(external_this_wp_element_["createElement"])("span", { |
|
12248 className: "editor-post-permalink-editor__prefix" |
|
12249 }, prefix), Object(external_this_wp_element_["createElement"])("input", { |
|
12250 className: "editor-post-permalink-editor__edit", |
|
12251 "aria-label": Object(external_this_wp_i18n_["__"])('Edit post permalink'), |
|
12252 value: editedPostName, |
|
12253 onChange: function onChange(event) { |
|
12254 return _this2.setState({ |
|
12255 editedPostName: event.target.value |
|
12256 }); |
|
12257 }, |
|
12258 type: "text", |
|
12259 autoFocus: true |
|
12260 }), Object(external_this_wp_element_["createElement"])("span", { |
|
12261 className: "editor-post-permalink-editor__suffix" |
|
12262 }, suffix), "\u200E"), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
12263 className: "editor-post-permalink-editor__save", |
|
12264 isLarge: true, |
|
12265 onClick: this.onSavePermalink |
|
12266 }, Object(external_this_wp_i18n_["__"])('Save'))); |
|
12267 /* eslint-enable jsx-a11y/no-autofocus */ |
|
12268 } |
|
12269 }]); |
|
12270 |
|
12271 return PostPermalinkEditor; |
|
12272 }(external_this_wp_element_["Component"]); |
|
12273 |
|
12274 /* harmony default export */ var post_permalink_editor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
|
12275 var _select = select('core/editor'), |
|
12276 getPermalinkParts = _select.getPermalinkParts; |
|
12277 |
|
12278 return { |
|
12279 permalinkParts: getPermalinkParts() |
|
12280 }; |
|
12281 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
|
12282 var _dispatch = dispatch('core/editor'), |
|
12283 editPost = _dispatch.editPost; |
|
12284 |
|
12285 return { |
|
12286 editPost: editPost |
|
12287 }; |
|
12288 })])(editor_PostPermalinkEditor)); |
|
12289 |
|
12290 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-permalink/index.js |
|
12291 |
|
12292 |
|
12293 |
|
12294 |
|
12295 |
|
12296 |
|
12297 |
|
12298 |
|
12299 /** |
|
12300 * External dependencies |
|
12301 */ |
|
12302 |
|
12303 |
|
12304 /** |
|
12305 * WordPress dependencies |
|
12306 */ |
|
12307 |
|
12308 |
|
12309 |
|
12310 |
|
12311 |
|
12312 |
|
12313 |
|
12314 /** |
|
12315 * Internal dependencies |
|
12316 */ |
|
12317 |
|
12318 |
|
12319 |
|
12320 |
|
12321 var post_permalink_PostPermalink = |
|
12322 /*#__PURE__*/ |
|
12323 function (_Component) { |
|
12324 Object(inherits["a" /* default */])(PostPermalink, _Component); |
|
12325 |
|
12326 function PostPermalink() { |
|
12327 var _this; |
|
12328 |
|
12329 Object(classCallCheck["a" /* default */])(this, PostPermalink); |
|
12330 |
|
12331 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPermalink).apply(this, arguments)); |
|
12332 _this.addVisibilityCheck = _this.addVisibilityCheck.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
12333 _this.onVisibilityChange = _this.onVisibilityChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
12334 _this.state = { |
|
12335 isCopied: false, |
|
12336 isEditingPermalink: false |
|
12337 }; |
|
12338 return _this; |
|
12339 } |
|
12340 |
|
12341 Object(createClass["a" /* default */])(PostPermalink, [{ |
|
12342 key: "addVisibilityCheck", |
|
12343 value: function addVisibilityCheck() { |
|
12344 window.addEventListener('visibilitychange', this.onVisibilityChange); |
|
12345 } |
|
12346 }, { |
|
12347 key: "onVisibilityChange", |
|
12348 value: function onVisibilityChange() { |
|
12349 var _this$props = this.props, |
|
12350 isEditable = _this$props.isEditable, |
|
12351 refreshPost = _this$props.refreshPost; // If the user just returned after having clicked the "Change Permalinks" button, |
|
12352 // fetch a new copy of the post from the server, just in case they enabled permalinks. |
|
12353 |
|
12354 if (!isEditable && 'visible' === document.visibilityState) { |
|
12355 refreshPost(); |
|
12356 } |
|
12357 } |
|
12358 }, { |
|
12359 key: "componentDidUpdate", |
|
12360 value: function componentDidUpdate(prevProps, prevState) { |
|
12361 // If we've just stopped editing the permalink, focus on the new permalink. |
|
12362 if (prevState.isEditingPermalink && !this.state.isEditingPermalink) { |
|
12363 this.linkElement.focus(); |
|
12364 } |
|
12365 } |
|
12366 }, { |
|
12367 key: "componentWillUnmount", |
|
12368 value: function componentWillUnmount() { |
|
12369 window.removeEventListener('visibilitychange', this.addVisibilityCheck); |
|
12370 } |
|
12371 }, { |
|
12372 key: "render", |
|
12373 value: function render() { |
|
12374 var _this2 = this; |
|
12375 |
|
12376 var _this$props2 = this.props, |
|
12377 isEditable = _this$props2.isEditable, |
|
12378 isNew = _this$props2.isNew, |
|
12379 isPublished = _this$props2.isPublished, |
|
12380 isViewable = _this$props2.isViewable, |
|
12381 permalinkParts = _this$props2.permalinkParts, |
|
12382 postLink = _this$props2.postLink, |
|
12383 postSlug = _this$props2.postSlug, |
|
12384 postID = _this$props2.postID, |
|
12385 postTitle = _this$props2.postTitle; |
|
12386 |
|
12387 if (isNew || !isViewable || !permalinkParts || !postLink) { |
|
12388 return null; |
|
12389 } |
|
12390 |
|
12391 var _this$state = this.state, |
|
12392 isCopied = _this$state.isCopied, |
|
12393 isEditingPermalink = _this$state.isEditingPermalink; |
|
12394 var ariaLabel = isCopied ? Object(external_this_wp_i18n_["__"])('Permalink copied') : Object(external_this_wp_i18n_["__"])('Copy the permalink'); |
|
12395 var prefix = permalinkParts.prefix, |
|
12396 suffix = permalinkParts.suffix; |
|
12397 var slug = Object(external_this_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID; |
|
12398 var samplePermalink = isEditable ? prefix + slug + suffix : prefix; |
|
12399 return Object(external_this_wp_element_["createElement"])("div", { |
|
12400 className: "editor-post-permalink" |
|
12401 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { |
|
12402 className: classnames_default()('editor-post-permalink__copy', { |
|
12403 'is-copied': isCopied |
|
12404 }), |
|
12405 text: samplePermalink, |
|
12406 label: ariaLabel, |
|
12407 onCopy: function onCopy() { |
|
12408 return _this2.setState({ |
|
12409 isCopied: true |
|
12410 }); |
|
12411 }, |
|
12412 "aria-disabled": isCopied, |
|
12413 icon: "admin-links" |
|
12414 }), Object(external_this_wp_element_["createElement"])("span", { |
|
12415 className: "editor-post-permalink__label" |
|
12416 }, Object(external_this_wp_i18n_["__"])('Permalink:')), !isEditingPermalink && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { |
|
12417 className: "editor-post-permalink__link", |
|
12418 href: !isPublished ? postLink : samplePermalink, |
|
12419 target: "_blank", |
|
12420 ref: function ref(linkElement) { |
|
12421 return _this2.linkElement = linkElement; |
|
12422 } |
|
12423 }, Object(external_this_wp_url_["safeDecodeURI"])(samplePermalink), "\u200E"), isEditingPermalink && Object(external_this_wp_element_["createElement"])(post_permalink_editor, { |
|
12424 slug: slug, |
|
12425 onSave: function onSave() { |
|
12426 return _this2.setState({ |
|
12427 isEditingPermalink: false |
|
12428 }); |
|
12429 } |
|
12430 }), isEditable && !isEditingPermalink && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
12431 className: "editor-post-permalink__edit", |
|
12432 isLarge: true, |
|
12433 onClick: function onClick() { |
|
12434 return _this2.setState({ |
|
12435 isEditingPermalink: true |
|
12436 }); |
|
12437 } |
|
12438 }, Object(external_this_wp_i18n_["__"])('Edit')), !isEditable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
12439 className: "editor-post-permalink__change", |
|
12440 isLarge: true, |
|
12441 href: getWPAdminURL('options-permalink.php'), |
|
12442 onClick: this.addVisibilityCheck, |
|
12443 target: "_blank" |
|
12444 }, Object(external_this_wp_i18n_["__"])('Change Permalinks'))); |
|
12445 } |
|
12446 }]); |
|
12447 |
|
12448 return PostPermalink; |
|
12449 }(external_this_wp_element_["Component"]); |
|
12450 |
|
12451 /* harmony default export */ var post_permalink = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
|
12452 var _select = select('core/editor'), |
|
12453 isEditedPostNew = _select.isEditedPostNew, |
|
12454 isPermalinkEditable = _select.isPermalinkEditable, |
|
12455 getCurrentPost = _select.getCurrentPost, |
|
12456 getPermalinkParts = _select.getPermalinkParts, |
|
12457 getEditedPostAttribute = _select.getEditedPostAttribute, |
|
12458 isCurrentPostPublished = _select.isCurrentPostPublished; |
|
12459 |
|
12460 var _select2 = select('core'), |
|
12461 getPostType = _select2.getPostType; |
|
12462 |
|
12463 var _getCurrentPost = getCurrentPost(), |
|
12464 id = _getCurrentPost.id, |
|
12465 link = _getCurrentPost.link; |
|
12466 |
|
12467 var postTypeName = getEditedPostAttribute('type'); |
|
12468 var postType = getPostType(postTypeName); |
|
12469 return { |
|
12470 isNew: isEditedPostNew(), |
|
12471 postLink: link, |
|
12472 permalinkParts: getPermalinkParts(), |
|
12473 postSlug: getEditedPostAttribute('slug'), |
|
12474 isEditable: isPermalinkEditable(), |
|
12475 isPublished: isCurrentPostPublished(), |
|
12476 postTitle: getEditedPostAttribute('title'), |
|
12477 postID: id, |
|
12478 isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false) |
|
12479 }; |
|
12480 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
|
12481 var _dispatch = dispatch('core/editor'), |
|
12482 refreshPost = _dispatch.refreshPost; |
|
12483 |
|
12484 return { |
|
12485 refreshPost: refreshPost |
|
12486 }; |
|
12487 })])(post_permalink_PostPermalink)); |
|
12488 |
|
12489 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js |
|
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 |
|
12497 |
|
12498 /** |
|
12499 * External dependencies |
|
12500 */ |
|
12501 |
|
12502 |
|
12503 |
|
12504 /** |
|
12505 * WordPress dependencies |
|
12506 */ |
|
12507 |
|
12508 |
|
12509 |
|
12510 |
|
12511 |
|
12512 |
|
12513 |
|
12514 |
|
12515 /** |
|
12516 * Internal dependencies |
|
12517 */ |
|
12518 |
|
12519 |
|
12520 |
|
12521 /** |
12664 /** |
12522 * Constants |
12665 * Constants |
12523 */ |
12666 */ |
12524 |
12667 |
12525 var REGEXP_NEWLINES = /[\r\n]+/g; |
12668 var REGEXP_NEWLINES = /[\r\n]+/g; |
12526 |
12669 |
12527 var post_title_PostTitle = |
12670 var post_title_PostTitle = /*#__PURE__*/function (_Component) { |
12528 /*#__PURE__*/ |
|
12529 function (_Component) { |
|
12530 Object(inherits["a" /* default */])(PostTitle, _Component); |
12671 Object(inherits["a" /* default */])(PostTitle, _Component); |
12672 |
|
12673 var _super = post_title_createSuper(PostTitle); |
|
12531 |
12674 |
12532 function PostTitle() { |
12675 function PostTitle() { |
12533 var _this; |
12676 var _this; |
12534 |
12677 |
12535 Object(classCallCheck["a" /* default */])(this, PostTitle); |
12678 Object(classCallCheck["a" /* default */])(this, PostTitle); |
12536 |
12679 |
12537 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostTitle).apply(this, arguments)); |
12680 _this = _super.apply(this, arguments); |
12538 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12681 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12539 _this.onSelect = _this.onSelect.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12682 _this.onSelect = _this.onSelect.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12540 _this.onUnselect = _this.onUnselect.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12683 _this.onUnselect = _this.onUnselect.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12541 _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12684 _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12542 _this.redirectHistory = _this.redirectHistory.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
12685 _this.onPaste = _this.onPaste.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
12543 _this.state = { |
12686 _this.state = { |
12544 isSelected: false |
12687 isSelected: false |
12545 }; |
12688 }; |
12546 return _this; |
12689 return _this; |
12547 } |
12690 } |
12548 |
12691 |
12549 Object(createClass["a" /* default */])(PostTitle, [{ |
12692 Object(createClass["a" /* default */])(PostTitle, [{ |
12550 key: "handleFocusOutside", |
|
12551 value: function handleFocusOutside() { |
|
12552 this.onUnselect(); |
|
12553 } |
|
12554 }, { |
|
12555 key: "onSelect", |
12693 key: "onSelect", |
12556 value: function onSelect() { |
12694 value: function onSelect() { |
12557 this.setState({ |
12695 this.setState({ |
12558 isSelected: true |
12696 isSelected: true |
12559 }); |
12697 }); |
12578 if (event.keyCode === external_this_wp_keycodes_["ENTER"]) { |
12716 if (event.keyCode === external_this_wp_keycodes_["ENTER"]) { |
12579 event.preventDefault(); |
12717 event.preventDefault(); |
12580 this.props.onEnterPress(); |
12718 this.props.onEnterPress(); |
12581 } |
12719 } |
12582 } |
12720 } |
12583 /** |
|
12584 * Emulates behavior of an undo or redo on its corresponding key press |
|
12585 * combination. This is a workaround to React's treatment of undo in a |
|
12586 * controlled textarea where characters are updated one at a time. |
|
12587 * Instead, leverage the store's undo handling of title changes. |
|
12588 * |
|
12589 * @see https://github.com/facebook/react/issues/8514 |
|
12590 * |
|
12591 * @param {KeyboardEvent} event Key event. |
|
12592 */ |
|
12593 |
|
12594 }, { |
12721 }, { |
12595 key: "redirectHistory", |
12722 key: "onPaste", |
12596 value: function redirectHistory(event) { |
12723 value: function onPaste(event) { |
12597 if (event.shiftKey) { |
12724 var _this$props = this.props, |
12598 this.props.onRedo(); |
12725 title = _this$props.title, |
12599 } else { |
12726 onInsertBlockAfter = _this$props.onInsertBlockAfter, |
12600 this.props.onUndo(); |
12727 onUpdate = _this$props.onUpdate; |
12728 var clipboardData = event.clipboardData; |
|
12729 var plainText = ''; |
|
12730 var html = ''; // IE11 only supports `Text` as an argument for `getData` and will |
|
12731 // otherwise throw an invalid argument error, so we try the standard |
|
12732 // arguments first, then fallback to `Text` if they fail. |
|
12733 |
|
12734 try { |
|
12735 plainText = clipboardData.getData('text/plain'); |
|
12736 html = clipboardData.getData('text/html'); |
|
12737 } catch (error1) { |
|
12738 try { |
|
12739 html = clipboardData.getData('Text'); |
|
12740 } catch (error2) { |
|
12741 // Some browsers like UC Browser paste plain text by default and |
|
12742 // don't support clipboardData at all, so allow default |
|
12743 // behaviour. |
|
12744 return; |
|
12745 } |
|
12746 } // Allows us to ask for this information when we get a report. |
|
12747 |
|
12748 |
|
12749 window.console.log('Received HTML:\n\n', html); |
|
12750 window.console.log('Received plain text:\n\n', plainText); |
|
12751 var content = Object(external_this_wp_blocks_["pasteHandler"])({ |
|
12752 HTML: html, |
|
12753 plainText: plainText |
|
12754 }); |
|
12755 |
|
12756 if (typeof content !== 'string' && content.length) { |
|
12757 event.preventDefault(); |
|
12758 |
|
12759 var _content = Object(slicedToArray["a" /* default */])(content, 1), |
|
12760 firstBlock = _content[0]; |
|
12761 |
|
12762 if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { |
|
12763 onUpdate(firstBlock.attributes.content); |
|
12764 onInsertBlockAfter(content.slice(1)); |
|
12765 } else { |
|
12766 onInsertBlockAfter(content); |
|
12767 } |
|
12601 } |
12768 } |
12602 |
|
12603 event.preventDefault(); |
|
12604 } |
12769 } |
12605 }, { |
12770 }, { |
12606 key: "render", |
12771 key: "render", |
12607 value: function render() { |
12772 value: function render() { |
12608 var _this$props = this.props, |
12773 var _this$props2 = this.props, |
12609 hasFixedToolbar = _this$props.hasFixedToolbar, |
12774 hasFixedToolbar = _this$props2.hasFixedToolbar, |
12610 isCleanNewPost = _this$props.isCleanNewPost, |
12775 isCleanNewPost = _this$props2.isCleanNewPost, |
12611 isFocusMode = _this$props.isFocusMode, |
12776 isFocusMode = _this$props2.isFocusMode, |
12612 isPostTypeViewable = _this$props.isPostTypeViewable, |
12777 instanceId = _this$props2.instanceId, |
12613 instanceId = _this$props.instanceId, |
12778 placeholder = _this$props2.placeholder, |
12614 placeholder = _this$props.placeholder, |
12779 title = _this$props2.title; |
12615 title = _this$props.title; |
|
12616 var isSelected = this.state.isSelected; // The wp-block className is important for editor styles. |
12780 var isSelected = this.state.isSelected; // The wp-block className is important for editor styles. |
12617 |
12781 // This same block is used in both the visual and the code editor. |
12618 var className = classnames_default()('wp-block editor-post-title__block', { |
12782 |
12783 var className = classnames_default()('wp-block editor-post-title editor-post-title__block', { |
|
12619 'is-selected': isSelected, |
12784 'is-selected': isSelected, |
12620 'is-focus-mode': isFocusMode, |
12785 'is-focus-mode': isFocusMode, |
12621 'has-fixed-toolbar': hasFixedToolbar |
12786 'has-fixed-toolbar': hasFixedToolbar |
12622 }); |
12787 }); |
12623 var decodedPlaceholder = Object(external_this_wp_htmlEntities_["decodeEntities"])(placeholder); |
12788 var decodedPlaceholder = Object(external_this_wp_htmlEntities_["decodeEntities"])(placeholder); |
12624 return Object(external_this_wp_element_["createElement"])(post_type_support_check, { |
12789 return Object(external_this_wp_element_["createElement"])(post_type_support_check, { |
12625 supportKeys: "title" |
12790 supportKeys: "title" |
12626 }, Object(external_this_wp_element_["createElement"])("div", { |
12791 }, Object(external_this_wp_element_["createElement"])("div", { |
12627 className: "editor-post-title" |
|
12628 }, Object(external_this_wp_element_["createElement"])("div", { |
|
12629 className: className |
12792 className: className |
12630 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { |
12793 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { |
12631 shortcuts: { |
12794 as: "label", |
12632 'mod+z': this.redirectHistory, |
12795 htmlFor: "post-title-".concat(instanceId) |
12633 'mod+shift+z': this.redirectHistory |
12796 }, decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title')), Object(external_this_wp_element_["createElement"])(lib_default.a, { |
12634 } |
|
12635 }, Object(external_this_wp_element_["createElement"])("label", { |
|
12636 htmlFor: "post-title-".concat(instanceId), |
|
12637 className: "screen-reader-text" |
|
12638 }, decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title')), Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, { |
|
12639 id: "post-title-".concat(instanceId), |
12797 id: "post-title-".concat(instanceId), |
12640 className: "editor-post-title__input", |
12798 className: "editor-post-title__input", |
12641 value: title, |
12799 value: title, |
12642 onChange: this.onChange, |
12800 onChange: this.onChange, |
12643 placeholder: decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title'), |
12801 placeholder: decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title'), |
12644 onFocus: this.onSelect, |
12802 onFocus: this.onSelect, |
12803 onBlur: this.onUnselect, |
|
12645 onKeyDown: this.onKeyDown, |
12804 onKeyDown: this.onKeyDown, |
12646 onKeyPress: this.onUnselect |
12805 onKeyPress: this.onUnselect, |
12806 onPaste: this.onPaste |
|
12647 /* |
12807 /* |
12648 Only autofocus the title when the post is entirely empty. |
12808 Only autofocus the title when the post is entirely empty. |
12649 This should only happen for a new post, which means we |
12809 This should only happen for a new post, which means we |
12650 focus the title on new post so the author can start typing |
12810 focus the title on new post so the author can start typing |
12651 right away, without needing to click anything. |
12811 right away, without needing to click anything. |
12652 */ |
12812 */ |
12653 |
12813 |
12654 /* eslint-disable jsx-a11y/no-autofocus */ |
12814 /* eslint-disable jsx-a11y/no-autofocus */ |
12655 , |
12815 , |
12656 autoFocus: isCleanNewPost |
12816 autoFocus: (document.body === document.activeElement || !document.activeElement) && isCleanNewPost |
12657 /* eslint-enable jsx-a11y/no-autofocus */ |
12817 /* eslint-enable jsx-a11y/no-autofocus */ |
12658 |
12818 |
12659 })), isSelected && isPostTypeViewable && Object(external_this_wp_element_["createElement"])(post_permalink, null)))); |
12819 }))); |
12660 } |
12820 } |
12661 }]); |
12821 }]); |
12662 |
12822 |
12663 return PostTitle; |
12823 return PostTitle; |
12664 }(external_this_wp_element_["Component"]); |
12824 }(external_this_wp_element_["Component"]); |
12669 isCleanNewPost = _select.isCleanNewPost; |
12829 isCleanNewPost = _select.isCleanNewPost; |
12670 |
12830 |
12671 var _select2 = select('core/block-editor'), |
12831 var _select2 = select('core/block-editor'), |
12672 getSettings = _select2.getSettings; |
12832 getSettings = _select2.getSettings; |
12673 |
12833 |
12674 var _select3 = select('core'), |
|
12675 getPostType = _select3.getPostType; |
|
12676 |
|
12677 var postType = getPostType(getEditedPostAttribute('type')); |
|
12678 |
|
12679 var _getSettings = getSettings(), |
12834 var _getSettings = getSettings(), |
12680 titlePlaceholder = _getSettings.titlePlaceholder, |
12835 titlePlaceholder = _getSettings.titlePlaceholder, |
12681 focusMode = _getSettings.focusMode, |
12836 focusMode = _getSettings.focusMode, |
12682 hasFixedToolbar = _getSettings.hasFixedToolbar; |
12837 hasFixedToolbar = _getSettings.hasFixedToolbar; |
12683 |
12838 |
12684 return { |
12839 return { |
12685 isCleanNewPost: isCleanNewPost(), |
12840 isCleanNewPost: isCleanNewPost(), |
12686 title: getEditedPostAttribute('title'), |
12841 title: getEditedPostAttribute('title'), |
12687 isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), |
|
12688 placeholder: titlePlaceholder, |
12842 placeholder: titlePlaceholder, |
12689 isFocusMode: focusMode, |
12843 isFocusMode: focusMode, |
12690 hasFixedToolbar: hasFixedToolbar |
12844 hasFixedToolbar: hasFixedToolbar |
12691 }; |
12845 }; |
12692 }); |
12846 }); |
12693 var post_title_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
12847 var post_title_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
12694 var _dispatch = dispatch('core/block-editor'), |
12848 var _dispatch = dispatch('core/block-editor'), |
12695 insertDefaultBlock = _dispatch.insertDefaultBlock, |
12849 insertDefaultBlock = _dispatch.insertDefaultBlock, |
12696 clearSelectedBlock = _dispatch.clearSelectedBlock; |
12850 clearSelectedBlock = _dispatch.clearSelectedBlock, |
12851 insertBlocks = _dispatch.insertBlocks; |
|
12697 |
12852 |
12698 var _dispatch2 = dispatch('core/editor'), |
12853 var _dispatch2 = dispatch('core/editor'), |
12699 editPost = _dispatch2.editPost, |
12854 editPost = _dispatch2.editPost; |
12700 undo = _dispatch2.undo, |
|
12701 redo = _dispatch2.redo; |
|
12702 |
12855 |
12703 return { |
12856 return { |
12704 onEnterPress: function onEnterPress() { |
12857 onEnterPress: function onEnterPress() { |
12705 insertDefaultBlock(undefined, undefined, 0); |
12858 insertDefaultBlock(undefined, undefined, 0); |
12859 }, |
|
12860 onInsertBlockAfter: function onInsertBlockAfter(blocks) { |
|
12861 insertBlocks(blocks, 0); |
|
12706 }, |
12862 }, |
12707 onUpdate: function onUpdate(title) { |
12863 onUpdate: function onUpdate(title) { |
12708 editPost({ |
12864 editPost({ |
12709 title: title |
12865 title: title |
12710 }); |
12866 }); |
12711 }, |
12867 }, |
12712 onUndo: undo, |
|
12713 onRedo: redo, |
|
12714 clearSelectedBlock: clearSelectedBlock |
12868 clearSelectedBlock: clearSelectedBlock |
12715 }; |
12869 }; |
12716 }); |
12870 }); |
12717 /* harmony default export */ var post_title = (Object(external_this_wp_compose_["compose"])(post_title_applyWithSelect, post_title_applyWithDispatch, external_this_wp_compose_["withInstanceId"], external_this_wp_components_["withFocusOutside"])(post_title_PostTitle)); |
12871 /* harmony default export */ var post_title = (Object(external_this_wp_compose_["compose"])(post_title_applyWithSelect, post_title_applyWithDispatch, external_this_wp_compose_["withInstanceId"])(post_title_PostTitle)); |
12718 |
12872 |
12719 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js |
12873 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js |
12720 |
12874 |
12721 |
12875 |
12722 |
12876 |
12741 var onClick = function onClick() { |
12895 var onClick = function onClick() { |
12742 return props.trashPost(postId, postType); |
12896 return props.trashPost(postId, postType); |
12743 }; |
12897 }; |
12744 |
12898 |
12745 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
12899 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
12746 className: "editor-post-trash button-link-delete", |
12900 className: "editor-post-trash", |
12747 onClick: onClick, |
12901 isDestructive: true, |
12748 isDefault: true, |
12902 isTertiary: true, |
12749 isLarge: true |
12903 onClick: onClick |
12750 }, Object(external_this_wp_i18n_["__"])('Move to trash')); |
12904 }, Object(external_this_wp_i18n_["__"])('Move to trash')); |
12751 } |
12905 } |
12752 |
12906 |
12753 /* harmony default export */ var post_trash = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
12907 /* harmony default export */ var post_trash = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
12754 var _select = select('core/editor'), |
12908 var _select = select('core/editor'), |
12774 |
12928 |
12775 |
12929 |
12776 function PostTrashCheck(_ref) { |
12930 function PostTrashCheck(_ref) { |
12777 var isNew = _ref.isNew, |
12931 var isNew = _ref.isNew, |
12778 postId = _ref.postId, |
12932 postId = _ref.postId, |
12933 canUserDelete = _ref.canUserDelete, |
|
12779 children = _ref.children; |
12934 children = _ref.children; |
12780 |
12935 |
12781 if (isNew || !postId) { |
12936 if (isNew || !postId || !canUserDelete) { |
12782 return null; |
12937 return null; |
12783 } |
12938 } |
12784 |
12939 |
12785 return children; |
12940 return children; |
12786 } |
12941 } |
12787 |
12942 |
12788 /* harmony default export */ var post_trash_check = (Object(external_this_wp_data_["withSelect"])(function (select) { |
12943 /* harmony default export */ var post_trash_check = (Object(external_this_wp_data_["withSelect"])(function (select) { |
12789 var _select = select('core/editor'), |
12944 var _select = select('core/editor'), |
12790 isEditedPostNew = _select.isEditedPostNew, |
12945 isEditedPostNew = _select.isEditedPostNew, |
12791 getCurrentPostId = _select.getCurrentPostId; |
12946 getCurrentPostId = _select.getCurrentPostId, |
12792 |
12947 getCurrentPostType = _select.getCurrentPostType; |
12948 |
|
12949 var _select2 = select('core'), |
|
12950 getPostType = _select2.getPostType, |
|
12951 canUser = _select2.canUser; |
|
12952 |
|
12953 var postId = getCurrentPostId(); |
|
12954 var postType = getPostType(getCurrentPostType()); |
|
12955 var resource = (postType === null || postType === void 0 ? void 0 : postType['rest_base']) || ''; |
|
12793 return { |
12956 return { |
12794 isNew: isEditedPostNew(), |
12957 isNew: isEditedPostNew(), |
12795 postId: getCurrentPostId() |
12958 postId: postId, |
12959 canUserDelete: postId && resource ? canUser('delete', resource, postId) : false |
|
12796 }; |
12960 }; |
12797 })(PostTrashCheck)); |
12961 })(PostTrashCheck)); |
12798 |
12962 |
12799 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js |
12963 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js |
12800 /** |
12964 /** |
12819 var _select = select('core/editor'), |
12983 var _select = select('core/editor'), |
12820 getCurrentPost = _select.getCurrentPost, |
12984 getCurrentPost = _select.getCurrentPost, |
12821 getCurrentPostType = _select.getCurrentPostType; |
12985 getCurrentPostType = _select.getCurrentPostType; |
12822 |
12986 |
12823 return { |
12987 return { |
12824 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
12988 hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
12825 postType: getCurrentPostType() |
12989 postType: getCurrentPostType() |
12826 }; |
12990 }; |
12827 })])(PostVisibilityCheck)); |
12991 })])(PostVisibilityCheck)); |
12828 |
12992 |
12993 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js |
|
12994 |
|
12995 |
|
12996 /** |
|
12997 * WordPress dependencies |
|
12998 */ |
|
12999 |
|
13000 var info_info = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { |
|
13001 xmlns: "http://www.w3.org/2000/svg", |
|
13002 viewBox: "0 0 24 24" |
|
13003 }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { |
|
13004 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" |
|
13005 })); |
|
13006 /* harmony default export */ var library_info = (info_info); |
|
13007 |
|
12829 // EXTERNAL MODULE: external {"this":["wp","wordcount"]} |
13008 // EXTERNAL MODULE: external {"this":["wp","wordcount"]} |
12830 var external_this_wp_wordcount_ = __webpack_require__(98); |
13009 var external_this_wp_wordcount_ = __webpack_require__(147); |
12831 |
13010 |
12832 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js |
13011 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js |
12833 |
13012 |
12834 |
13013 |
12835 /** |
13014 /** |
12866 /** |
13045 /** |
12867 * WordPress dependencies |
13046 * WordPress dependencies |
12868 */ |
13047 */ |
12869 |
13048 |
12870 |
13049 |
12871 |
|
12872 /** |
13050 /** |
12873 * Internal dependencies |
13051 * Internal dependencies |
12874 */ |
13052 */ |
12875 |
13053 |
12876 |
13054 |
12877 |
13055 |
12878 |
13056 |
12879 function TableOfContentsPanel(_ref) { |
13057 function TableOfContentsPanel(_ref) { |
12880 var headingCount = _ref.headingCount, |
13058 var hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled, |
12881 paragraphCount = _ref.paragraphCount, |
|
12882 numberOfBlocks = _ref.numberOfBlocks, |
|
12883 hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled, |
|
12884 onRequestClose = _ref.onRequestClose; |
13059 onRequestClose = _ref.onRequestClose; |
12885 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { |
13060 |
12886 className: "table-of-contents__counts", |
13061 var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { |
12887 role: "note", |
13062 var _select = select('core/block-editor'), |
12888 "aria-label": Object(external_this_wp_i18n_["__"])('Document Statistics'), |
13063 getGlobalBlockCount = _select.getGlobalBlockCount; |
12889 tabIndex: "0" |
13064 |
12890 }, Object(external_this_wp_element_["createElement"])("div", { |
13065 return { |
12891 className: "table-of-contents__count" |
13066 headingCount: getGlobalBlockCount('core/heading'), |
12892 }, Object(external_this_wp_i18n_["__"])('Words'), Object(external_this_wp_element_["createElement"])(word_count, null)), Object(external_this_wp_element_["createElement"])("div", { |
13067 paragraphCount: getGlobalBlockCount('core/paragraph'), |
12893 className: "table-of-contents__count" |
13068 numberOfBlocks: getGlobalBlockCount() |
12894 }, Object(external_this_wp_i18n_["__"])('Headings'), Object(external_this_wp_element_["createElement"])("span", { |
13069 }; |
12895 className: "table-of-contents__number" |
13070 }, []), |
12896 }, headingCount)), Object(external_this_wp_element_["createElement"])("div", { |
13071 headingCount = _useSelect.headingCount, |
12897 className: "table-of-contents__count" |
13072 paragraphCount = _useSelect.paragraphCount, |
12898 }, Object(external_this_wp_i18n_["__"])('Paragraphs'), Object(external_this_wp_element_["createElement"])("span", { |
13073 numberOfBlocks = _useSelect.numberOfBlocks; |
12899 className: "table-of-contents__number" |
13074 |
12900 }, paragraphCount)), Object(external_this_wp_element_["createElement"])("div", { |
13075 return ( |
12901 className: "table-of-contents__count" |
13076 /* |
12902 }, Object(external_this_wp_i18n_["__"])('Blocks'), Object(external_this_wp_element_["createElement"])("span", { |
13077 * Disable reason: The `list` ARIA role is redundant but |
12903 className: "table-of-contents__number" |
13078 * Safari+VoiceOver won't announce the list otherwise. |
12904 }, numberOfBlocks))), headingCount > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("hr", null), Object(external_this_wp_element_["createElement"])("span", { |
13079 */ |
12905 className: "table-of-contents__title" |
13080 |
12906 }, Object(external_this_wp_i18n_["__"])('Document Outline')), Object(external_this_wp_element_["createElement"])(document_outline, { |
13081 /* eslint-disable jsx-a11y/no-redundant-roles */ |
12907 onSelect: onRequestClose, |
13082 Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { |
12908 hasOutlineItemsDisabled: hasOutlineItemsDisabled |
13083 className: "table-of-contents__wrapper", |
12909 }))); |
13084 role: "note", |
12910 } |
13085 "aria-label": Object(external_this_wp_i18n_["__"])('Document Statistics'), |
12911 |
13086 tabIndex: "0" |
12912 /* harmony default export */ var panel = (Object(external_this_wp_data_["withSelect"])(function (select) { |
13087 }, Object(external_this_wp_element_["createElement"])("ul", { |
12913 var _select = select('core/block-editor'), |
13088 role: "list", |
12914 getGlobalBlockCount = _select.getGlobalBlockCount; |
13089 className: "table-of-contents__counts" |
12915 |
13090 }, Object(external_this_wp_element_["createElement"])("li", { |
12916 return { |
13091 className: "table-of-contents__count" |
12917 headingCount: getGlobalBlockCount('core/heading'), |
13092 }, Object(external_this_wp_i18n_["__"])('Words'), Object(external_this_wp_element_["createElement"])(word_count, null)), Object(external_this_wp_element_["createElement"])("li", { |
12918 paragraphCount: getGlobalBlockCount('core/paragraph'), |
13093 className: "table-of-contents__count" |
12919 numberOfBlocks: getGlobalBlockCount() |
13094 }, Object(external_this_wp_i18n_["__"])('Headings'), Object(external_this_wp_element_["createElement"])("span", { |
12920 }; |
13095 className: "table-of-contents__number" |
12921 })(TableOfContentsPanel)); |
13096 }, headingCount)), Object(external_this_wp_element_["createElement"])("li", { |
13097 className: "table-of-contents__count" |
|
13098 }, Object(external_this_wp_i18n_["__"])('Paragraphs'), Object(external_this_wp_element_["createElement"])("span", { |
|
13099 className: "table-of-contents__number" |
|
13100 }, paragraphCount)), Object(external_this_wp_element_["createElement"])("li", { |
|
13101 className: "table-of-contents__count" |
|
13102 }, Object(external_this_wp_i18n_["__"])('Blocks'), Object(external_this_wp_element_["createElement"])("span", { |
|
13103 className: "table-of-contents__number" |
|
13104 }, numberOfBlocks)))), headingCount > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("hr", null), Object(external_this_wp_element_["createElement"])("h2", { |
|
13105 className: "table-of-contents__title" |
|
13106 }, Object(external_this_wp_i18n_["__"])('Document Outline')), Object(external_this_wp_element_["createElement"])(document_outline, { |
|
13107 onSelect: onRequestClose, |
|
13108 hasOutlineItemsDisabled: hasOutlineItemsDisabled |
|
13109 }))) |
|
13110 /* eslint-enable jsx-a11y/no-redundant-roles */ |
|
13111 |
|
13112 ); |
|
13113 } |
|
13114 |
|
13115 /* harmony default export */ var panel = (TableOfContentsPanel); |
|
12922 |
13116 |
12923 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js |
13117 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js |
12924 |
13118 |
12925 |
13119 |
13120 |
|
13121 |
|
12926 /** |
13122 /** |
12927 * WordPress dependencies |
13123 * WordPress dependencies |
12928 */ |
13124 */ |
12929 |
13125 |
12930 |
13126 |
12931 |
13127 |
13128 |
|
13129 |
|
12932 /** |
13130 /** |
12933 * Internal dependencies |
13131 * Internal dependencies |
12934 */ |
13132 */ |
12935 |
13133 |
12936 |
13134 |
12937 |
13135 |
12938 function TableOfContents(_ref) { |
13136 function TableOfContents(_ref, ref) { |
12939 var hasBlocks = _ref.hasBlocks, |
13137 var hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled, |
12940 hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled; |
13138 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["hasOutlineItemsDisabled"]); |
13139 |
|
13140 var hasBlocks = Object(external_this_wp_data_["useSelect"])(function (select) { |
|
13141 return !!select('core/block-editor').getBlockCount(); |
|
13142 }, []); |
|
12941 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { |
13143 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { |
12942 position: "bottom", |
13144 position: "bottom", |
12943 className: "table-of-contents", |
13145 className: "table-of-contents", |
12944 contentClassName: "table-of-contents__popover", |
13146 contentClassName: "table-of-contents__popover", |
12945 renderToggle: function renderToggle(_ref2) { |
13147 renderToggle: function renderToggle(_ref2) { |
12946 var isOpen = _ref2.isOpen, |
13148 var isOpen = _ref2.isOpen, |
12947 onToggle = _ref2.onToggle; |
13149 onToggle = _ref2.onToggle; |
12948 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
13150 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { |
13151 ref: ref, |
|
12949 onClick: hasBlocks ? onToggle : undefined, |
13152 onClick: hasBlocks ? onToggle : undefined, |
12950 icon: "info-outline", |
13153 icon: library_info, |
12951 "aria-expanded": isOpen, |
13154 "aria-expanded": isOpen, |
12952 label: Object(external_this_wp_i18n_["__"])('Content structure'), |
13155 label: Object(external_this_wp_i18n_["__"])('Content structure'), |
12953 labelPosition: "bottom", |
13156 tooltipPosition: "bottom", |
12954 "aria-disabled": !hasBlocks |
13157 "aria-disabled": !hasBlocks |
12955 }); |
13158 })); |
12956 }, |
13159 }, |
12957 renderContent: function renderContent(_ref3) { |
13160 renderContent: function renderContent(_ref3) { |
12958 var onClose = _ref3.onClose; |
13161 var onClose = _ref3.onClose; |
12959 return Object(external_this_wp_element_["createElement"])(panel, { |
13162 return Object(external_this_wp_element_["createElement"])(panel, { |
12960 onRequestClose: onClose, |
13163 onRequestClose: onClose, |
12962 }); |
13165 }); |
12963 } |
13166 } |
12964 }); |
13167 }); |
12965 } |
13168 } |
12966 |
13169 |
12967 /* harmony default export */ var table_of_contents = (Object(external_this_wp_data_["withSelect"])(function (select) { |
13170 /* harmony default export */ var table_of_contents = (Object(external_this_wp_element_["forwardRef"])(TableOfContents)); |
12968 return { |
|
12969 hasBlocks: !!select('core/block-editor').getBlockCount() |
|
12970 }; |
|
12971 })(TableOfContents)); |
|
12972 |
13171 |
12973 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js |
13172 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js |
12974 |
13173 |
12975 |
13174 |
12976 |
13175 |
12977 |
13176 |
12978 |
13177 |
12979 |
13178 |
12980 |
13179 |
13180 function unsaved_changes_warning_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (unsaved_changes_warning_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
13181 |
|
13182 function unsaved_changes_warning_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
13183 |
|
12981 /** |
13184 /** |
12982 * WordPress dependencies |
13185 * WordPress dependencies |
12983 */ |
13186 */ |
12984 |
13187 |
12985 |
13188 |
12986 |
13189 |
12987 |
13190 |
12988 var unsaved_changes_warning_UnsavedChangesWarning = |
13191 var unsaved_changes_warning_UnsavedChangesWarning = /*#__PURE__*/function (_Component) { |
12989 /*#__PURE__*/ |
|
12990 function (_Component) { |
|
12991 Object(inherits["a" /* default */])(UnsavedChangesWarning, _Component); |
13192 Object(inherits["a" /* default */])(UnsavedChangesWarning, _Component); |
13193 |
|
13194 var _super = unsaved_changes_warning_createSuper(UnsavedChangesWarning); |
|
12992 |
13195 |
12993 function UnsavedChangesWarning() { |
13196 function UnsavedChangesWarning() { |
12994 var _this; |
13197 var _this; |
12995 |
13198 |
12996 Object(classCallCheck["a" /* default */])(this, UnsavedChangesWarning); |
13199 Object(classCallCheck["a" /* default */])(this, UnsavedChangesWarning); |
12997 |
13200 |
12998 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(UnsavedChangesWarning).apply(this, arguments)); |
13201 _this = _super.apply(this, arguments); |
12999 _this.warnIfUnsavedChanges = _this.warnIfUnsavedChanges.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
13202 _this.warnIfUnsavedChanges = _this.warnIfUnsavedChanges.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
13000 return _this; |
13203 return _this; |
13001 } |
13204 } |
13002 |
13205 |
13003 Object(createClass["a" /* default */])(UnsavedChangesWarning, [{ |
13206 Object(createClass["a" /* default */])(UnsavedChangesWarning, [{ |
13004 key: "componentDidMount", |
13207 key: "componentDidMount", |
13019 */ |
13222 */ |
13020 |
13223 |
13021 }, { |
13224 }, { |
13022 key: "warnIfUnsavedChanges", |
13225 key: "warnIfUnsavedChanges", |
13023 value: function warnIfUnsavedChanges(event) { |
13226 value: function warnIfUnsavedChanges(event) { |
13024 var isDirty = this.props.isDirty; |
13227 var isEditedPostDirty = this.props.isEditedPostDirty; |
13025 |
13228 |
13026 if (isDirty) { |
13229 if (isEditedPostDirty()) { |
13027 event.returnValue = Object(external_this_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); |
13230 event.returnValue = Object(external_this_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); |
13028 return event.returnValue; |
13231 return event.returnValue; |
13029 } |
13232 } |
13030 } |
13233 } |
13031 }, { |
13234 }, { |
13038 return UnsavedChangesWarning; |
13241 return UnsavedChangesWarning; |
13039 }(external_this_wp_element_["Component"]); |
13242 }(external_this_wp_element_["Component"]); |
13040 |
13243 |
13041 /* harmony default export */ var unsaved_changes_warning = (Object(external_this_wp_data_["withSelect"])(function (select) { |
13244 /* harmony default export */ var unsaved_changes_warning = (Object(external_this_wp_data_["withSelect"])(function (select) { |
13042 return { |
13245 return { |
13043 isDirty: select('core/editor').isEditedPostDirty() |
13246 // We need to call the selector directly in the listener to avoid race |
13247 // conditions with `BrowserURL` where `componentDidUpdate` gets the |
|
13248 // new value of `isEditedPostDirty` before this component does, |
|
13249 // causing this component to incorrectly think a trashed post is still dirty. |
|
13250 isEditedPostDirty: select('core/editor').isEditedPostDirty |
|
13044 }; |
13251 }; |
13045 })(unsaved_changes_warning_UnsavedChangesWarning)); |
13252 })(unsaved_changes_warning_UnsavedChangesWarning)); |
13046 |
13253 |
13047 // EXTERNAL MODULE: ./node_modules/memize/index.js |
13254 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js |
13048 var memize = __webpack_require__(41); |
13255 |
13049 var memize_default = /*#__PURE__*/__webpack_require__.n(memize); |
13256 |
13050 |
13257 |
13051 // EXTERNAL MODULE: ./node_modules/traverse/index.js |
13258 |
13052 var traverse = __webpack_require__(227); |
13259 /** |
13053 var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse); |
13260 * WordPress dependencies |
13054 |
13261 */ |
13055 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/parse.js |
13262 |
13056 |
13263 |
13057 |
13264 |
13058 /* eslint-disable @wordpress/no-unused-vars-before-return */ |
13265 |
13059 // Adapted from https://github.com/reworkcss/css |
13266 /** |
13060 // because we needed to remove source map support. |
13267 * Internal dependencies |
13061 // http://www.w3.org/TR/CSS21/grammar.htm |
13268 */ |
13062 // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 |
13269 |
13063 var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; |
13270 |
13064 /* harmony default export */ var parse = (function (css, options) { |
13271 |
13065 options = options || {}; |
13272 var withRegistryProvider = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (WrappedComponent) { |
13066 /** |
13273 return Object(external_this_wp_data_["withRegistry"])(function (props) { |
13067 * Positional. |
13274 var _props$useSubRegistry = props.useSubRegistry, |
13068 */ |
13275 useSubRegistry = _props$useSubRegistry === void 0 ? true : _props$useSubRegistry, |
13069 |
13276 registry = props.registry, |
13070 var lineno = 1; |
13277 additionalProps = Object(objectWithoutProperties["a" /* default */])(props, ["useSubRegistry", "registry"]); |
13071 var column = 1; |
13278 |
13072 /** |
13279 if (!useSubRegistry) { |
13073 * Update lineno and column based on `str`. |
13280 return Object(external_this_wp_element_["createElement"])(WrappedComponent, additionalProps); |
13074 */ |
13281 } |
13075 |
13282 |
13076 function updatePosition(str) { |
13283 var _useState = Object(external_this_wp_element_["useState"])(null), |
13077 var lines = str.match(/\n/g); |
13284 _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), |
13078 |
13285 subRegistry = _useState2[0], |
13079 if (lines) { |
13286 setSubRegistry = _useState2[1]; |
13080 lineno += lines.length; |
13287 |
13081 } |
13288 Object(external_this_wp_element_["useEffect"])(function () { |
13082 |
13289 var newRegistry = Object(external_this_wp_data_["createRegistry"])({ |
13083 var i = str.lastIndexOf('\n'); // eslint-disable-next-line no-bitwise |
13290 'core/block-editor': external_this_wp_blockEditor_["storeConfig"] |
13084 |
13291 }, registry); |
13085 column = ~i ? str.length - i : column + str.length; |
13292 var store = newRegistry.registerStore('core/editor', storeConfig); // This should be removed after the refactoring of the effects to controls. |
13086 } |
13293 |
13087 /** |
13294 middlewares(store); |
13088 * Mark position and patch `node.position`. |
13295 setSubRegistry(newRegistry); |
13089 */ |
13296 }, [registry]); |
13090 |
13297 |
13091 |
13298 if (!subRegistry) { |
13092 function position() { |
13299 return null; |
13093 var start = { |
13300 } |
13094 line: lineno, |
13301 |
13095 column: column |
13302 return Object(external_this_wp_element_["createElement"])(external_this_wp_data_["RegistryProvider"], { |
13096 }; |
13303 value: subRegistry |
13097 return function (node) { |
13304 }, Object(external_this_wp_element_["createElement"])(WrappedComponent, additionalProps)); |
13098 node.position = new Position(start); |
13305 }); |
13099 whitespace(); |
13306 }, 'withRegistryProvider'); |
13100 return node; |
13307 /* harmony default export */ var with_registry_provider = (withRegistryProvider); |
13101 }; |
13308 |
13102 } |
13309 // EXTERNAL MODULE: external {"this":["wp","mediaUtils"]} |
13103 /** |
13310 var external_this_wp_mediaUtils_ = __webpack_require__(152); |
13104 * Store position information for a node |
13311 |
13105 */ |
13312 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js |
13106 |
13313 |
13107 |
13314 |
13108 function Position(start) { |
13315 function media_upload_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
13109 this.start = start; |
13316 |
13110 this.end = { |
13317 function media_upload_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { media_upload_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { media_upload_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
13111 line: lineno, |
|
13112 column: column |
|
13113 }; |
|
13114 this.source = options.source; |
|
13115 } |
|
13116 /** |
|
13117 * Non-enumerable source string |
|
13118 */ |
|
13119 |
|
13120 |
|
13121 Position.prototype.content = css; |
|
13122 /** |
|
13123 * Error `msg`. |
|
13124 */ |
|
13125 |
|
13126 var errorsList = []; |
|
13127 |
|
13128 function error(msg) { |
|
13129 var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); |
|
13130 err.reason = msg; |
|
13131 err.filename = options.source; |
|
13132 err.line = lineno; |
|
13133 err.column = column; |
|
13134 err.source = css; |
|
13135 |
|
13136 if (options.silent) { |
|
13137 errorsList.push(err); |
|
13138 } else { |
|
13139 throw err; |
|
13140 } |
|
13141 } |
|
13142 /** |
|
13143 * Parse stylesheet. |
|
13144 */ |
|
13145 |
|
13146 |
|
13147 function stylesheet() { |
|
13148 var rulesList = rules(); |
|
13149 return { |
|
13150 type: 'stylesheet', |
|
13151 stylesheet: { |
|
13152 source: options.source, |
|
13153 rules: rulesList, |
|
13154 parsingErrors: errorsList |
|
13155 } |
|
13156 }; |
|
13157 } |
|
13158 /** |
|
13159 * Opening brace. |
|
13160 */ |
|
13161 |
|
13162 |
|
13163 function open() { |
|
13164 return match(/^{\s*/); |
|
13165 } |
|
13166 /** |
|
13167 * Closing brace. |
|
13168 */ |
|
13169 |
|
13170 |
|
13171 function close() { |
|
13172 return match(/^}/); |
|
13173 } |
|
13174 /** |
|
13175 * Parse ruleset. |
|
13176 */ |
|
13177 |
|
13178 |
|
13179 function rules() { |
|
13180 var node; |
|
13181 var accumulator = []; |
|
13182 whitespace(); |
|
13183 comments(accumulator); |
|
13184 |
|
13185 while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) { |
|
13186 if (node !== false) { |
|
13187 accumulator.push(node); |
|
13188 comments(accumulator); |
|
13189 } |
|
13190 } |
|
13191 |
|
13192 return accumulator; |
|
13193 } |
|
13194 /** |
|
13195 * Match `re` and return captures. |
|
13196 */ |
|
13197 |
|
13198 |
|
13199 function match(re) { |
|
13200 var m = re.exec(css); |
|
13201 |
|
13202 if (!m) { |
|
13203 return; |
|
13204 } |
|
13205 |
|
13206 var str = m[0]; |
|
13207 updatePosition(str); |
|
13208 css = css.slice(str.length); |
|
13209 return m; |
|
13210 } |
|
13211 /** |
|
13212 * Parse whitespace. |
|
13213 */ |
|
13214 |
|
13215 |
|
13216 function whitespace() { |
|
13217 match(/^\s*/); |
|
13218 } |
|
13219 /** |
|
13220 * Parse comments; |
|
13221 */ |
|
13222 |
|
13223 |
|
13224 function comments(accumulator) { |
|
13225 var c; |
|
13226 accumulator = accumulator || []; // eslint-disable-next-line no-cond-assign |
|
13227 |
|
13228 while (c = comment()) { |
|
13229 if (c !== false) { |
|
13230 accumulator.push(c); |
|
13231 } |
|
13232 } |
|
13233 |
|
13234 return accumulator; |
|
13235 } |
|
13236 /** |
|
13237 * Parse comment. |
|
13238 */ |
|
13239 |
|
13240 |
|
13241 function comment() { |
|
13242 var pos = position(); |
|
13243 |
|
13244 if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) { |
|
13245 return; |
|
13246 } |
|
13247 |
|
13248 var i = 2; |
|
13249 |
|
13250 while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) { |
|
13251 ++i; |
|
13252 } |
|
13253 |
|
13254 i += 2; |
|
13255 |
|
13256 if ('' === css.charAt(i - 1)) { |
|
13257 return error('End of comment missing'); |
|
13258 } |
|
13259 |
|
13260 var str = css.slice(2, i - 2); |
|
13261 column += 2; |
|
13262 updatePosition(str); |
|
13263 css = css.slice(i); |
|
13264 column += 2; |
|
13265 return pos({ |
|
13266 type: 'comment', |
|
13267 comment: str |
|
13268 }); |
|
13269 } |
|
13270 /** |
|
13271 * Parse selector. |
|
13272 */ |
|
13273 |
|
13274 |
|
13275 function selector() { |
|
13276 var m = match(/^([^{]+)/); |
|
13277 |
|
13278 if (!m) { |
|
13279 return; |
|
13280 } |
|
13281 /* @fix Remove all comments from selectors |
|
13282 * http://ostermiller.org/findcomment.html */ |
|
13283 |
|
13284 |
|
13285 return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (matched) { |
|
13286 return matched.replace(/,/g, "\u200C"); |
|
13287 }).split(/\s*(?![^(]*\)),\s*/).map(function (s) { |
|
13288 return s.replace(/\u200C/g, ','); |
|
13289 }); |
|
13290 } |
|
13291 /** |
|
13292 * Parse declaration. |
|
13293 */ |
|
13294 |
|
13295 |
|
13296 function declaration() { |
|
13297 var pos = position(); // prop |
|
13298 |
|
13299 var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); |
|
13300 |
|
13301 if (!prop) { |
|
13302 return; |
|
13303 } |
|
13304 |
|
13305 prop = trim(prop[0]); // : |
|
13306 |
|
13307 if (!match(/^:\s*/)) { |
|
13308 return error("property missing ':'"); |
|
13309 } // val |
|
13310 |
|
13311 |
|
13312 var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); |
|
13313 var ret = pos({ |
|
13314 type: 'declaration', |
|
13315 property: prop.replace(commentre, ''), |
|
13316 value: val ? trim(val[0]).replace(commentre, '') : '' |
|
13317 }); // ; |
|
13318 |
|
13319 match(/^[;\s]*/); |
|
13320 return ret; |
|
13321 } |
|
13322 /** |
|
13323 * Parse declarations. |
|
13324 */ |
|
13325 |
|
13326 |
|
13327 function declarations() { |
|
13328 var decls = []; |
|
13329 |
|
13330 if (!open()) { |
|
13331 return error("missing '{'"); |
|
13332 } |
|
13333 |
|
13334 comments(decls); // declarations |
|
13335 |
|
13336 var decl; // eslint-disable-next-line no-cond-assign |
|
13337 |
|
13338 while (decl = declaration()) { |
|
13339 if (decl !== false) { |
|
13340 decls.push(decl); |
|
13341 comments(decls); |
|
13342 } |
|
13343 } |
|
13344 |
|
13345 if (!close()) { |
|
13346 return error("missing '}'"); |
|
13347 } |
|
13348 |
|
13349 return decls; |
|
13350 } |
|
13351 /** |
|
13352 * Parse keyframe. |
|
13353 */ |
|
13354 |
|
13355 |
|
13356 function keyframe() { |
|
13357 var m; |
|
13358 var vals = []; |
|
13359 var pos = position(); // eslint-disable-next-line no-cond-assign |
|
13360 |
|
13361 while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) { |
|
13362 vals.push(m[1]); |
|
13363 match(/^,\s*/); |
|
13364 } |
|
13365 |
|
13366 if (!vals.length) { |
|
13367 return; |
|
13368 } |
|
13369 |
|
13370 return pos({ |
|
13371 type: 'keyframe', |
|
13372 values: vals, |
|
13373 declarations: declarations() |
|
13374 }); |
|
13375 } |
|
13376 /** |
|
13377 * Parse keyframes. |
|
13378 */ |
|
13379 |
|
13380 |
|
13381 function atkeyframes() { |
|
13382 var pos = position(); |
|
13383 var m = match(/^@([-\w]+)?keyframes\s*/); |
|
13384 |
|
13385 if (!m) { |
|
13386 return; |
|
13387 } |
|
13388 |
|
13389 var vendor = m[1]; // identifier |
|
13390 |
|
13391 m = match(/^([-\w]+)\s*/); |
|
13392 |
|
13393 if (!m) { |
|
13394 return error('@keyframes missing name'); |
|
13395 } |
|
13396 |
|
13397 var name = m[1]; |
|
13398 |
|
13399 if (!open()) { |
|
13400 return error("@keyframes missing '{'"); |
|
13401 } |
|
13402 |
|
13403 var frame; |
|
13404 var frames = comments(); // eslint-disable-next-line no-cond-assign |
|
13405 |
|
13406 while (frame = keyframe()) { |
|
13407 frames.push(frame); |
|
13408 frames = frames.concat(comments()); |
|
13409 } |
|
13410 |
|
13411 if (!close()) { |
|
13412 return error("@keyframes missing '}'"); |
|
13413 } |
|
13414 |
|
13415 return pos({ |
|
13416 type: 'keyframes', |
|
13417 name: name, |
|
13418 vendor: vendor, |
|
13419 keyframes: frames |
|
13420 }); |
|
13421 } |
|
13422 /** |
|
13423 * Parse supports. |
|
13424 */ |
|
13425 |
|
13426 |
|
13427 function atsupports() { |
|
13428 var pos = position(); |
|
13429 var m = match(/^@supports *([^{]+)/); |
|
13430 |
|
13431 if (!m) { |
|
13432 return; |
|
13433 } |
|
13434 |
|
13435 var supports = trim(m[1]); |
|
13436 |
|
13437 if (!open()) { |
|
13438 return error("@supports missing '{'"); |
|
13439 } |
|
13440 |
|
13441 var style = comments().concat(rules()); |
|
13442 |
|
13443 if (!close()) { |
|
13444 return error("@supports missing '}'"); |
|
13445 } |
|
13446 |
|
13447 return pos({ |
|
13448 type: 'supports', |
|
13449 supports: supports, |
|
13450 rules: style |
|
13451 }); |
|
13452 } |
|
13453 /** |
|
13454 * Parse host. |
|
13455 */ |
|
13456 |
|
13457 |
|
13458 function athost() { |
|
13459 var pos = position(); |
|
13460 var m = match(/^@host\s*/); |
|
13461 |
|
13462 if (!m) { |
|
13463 return; |
|
13464 } |
|
13465 |
|
13466 if (!open()) { |
|
13467 return error("@host missing '{'"); |
|
13468 } |
|
13469 |
|
13470 var style = comments().concat(rules()); |
|
13471 |
|
13472 if (!close()) { |
|
13473 return error("@host missing '}'"); |
|
13474 } |
|
13475 |
|
13476 return pos({ |
|
13477 type: 'host', |
|
13478 rules: style |
|
13479 }); |
|
13480 } |
|
13481 /** |
|
13482 * Parse media. |
|
13483 */ |
|
13484 |
|
13485 |
|
13486 function atmedia() { |
|
13487 var pos = position(); |
|
13488 var m = match(/^@media *([^{]+)/); |
|
13489 |
|
13490 if (!m) { |
|
13491 return; |
|
13492 } |
|
13493 |
|
13494 var media = trim(m[1]); |
|
13495 |
|
13496 if (!open()) { |
|
13497 return error("@media missing '{'"); |
|
13498 } |
|
13499 |
|
13500 var style = comments().concat(rules()); |
|
13501 |
|
13502 if (!close()) { |
|
13503 return error("@media missing '}'"); |
|
13504 } |
|
13505 |
|
13506 return pos({ |
|
13507 type: 'media', |
|
13508 media: media, |
|
13509 rules: style |
|
13510 }); |
|
13511 } |
|
13512 /** |
|
13513 * Parse custom-media. |
|
13514 */ |
|
13515 |
|
13516 |
|
13517 function atcustommedia() { |
|
13518 var pos = position(); |
|
13519 var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); |
|
13520 |
|
13521 if (!m) { |
|
13522 return; |
|
13523 } |
|
13524 |
|
13525 return pos({ |
|
13526 type: 'custom-media', |
|
13527 name: trim(m[1]), |
|
13528 media: trim(m[2]) |
|
13529 }); |
|
13530 } |
|
13531 /** |
|
13532 * Parse paged media. |
|
13533 */ |
|
13534 |
|
13535 |
|
13536 function atpage() { |
|
13537 var pos = position(); |
|
13538 var m = match(/^@page */); |
|
13539 |
|
13540 if (!m) { |
|
13541 return; |
|
13542 } |
|
13543 |
|
13544 var sel = selector() || []; |
|
13545 |
|
13546 if (!open()) { |
|
13547 return error("@page missing '{'"); |
|
13548 } |
|
13549 |
|
13550 var decls = comments(); // declarations |
|
13551 |
|
13552 var decl; // eslint-disable-next-line no-cond-assign |
|
13553 |
|
13554 while (decl = declaration()) { |
|
13555 decls.push(decl); |
|
13556 decls = decls.concat(comments()); |
|
13557 } |
|
13558 |
|
13559 if (!close()) { |
|
13560 return error("@page missing '}'"); |
|
13561 } |
|
13562 |
|
13563 return pos({ |
|
13564 type: 'page', |
|
13565 selectors: sel, |
|
13566 declarations: decls |
|
13567 }); |
|
13568 } |
|
13569 /** |
|
13570 * Parse document. |
|
13571 */ |
|
13572 |
|
13573 |
|
13574 function atdocument() { |
|
13575 var pos = position(); |
|
13576 var m = match(/^@([-\w]+)?document *([^{]+)/); |
|
13577 |
|
13578 if (!m) { |
|
13579 return; |
|
13580 } |
|
13581 |
|
13582 var vendor = trim(m[1]); |
|
13583 var doc = trim(m[2]); |
|
13584 |
|
13585 if (!open()) { |
|
13586 return error("@document missing '{'"); |
|
13587 } |
|
13588 |
|
13589 var style = comments().concat(rules()); |
|
13590 |
|
13591 if (!close()) { |
|
13592 return error("@document missing '}'"); |
|
13593 } |
|
13594 |
|
13595 return pos({ |
|
13596 type: 'document', |
|
13597 document: doc, |
|
13598 vendor: vendor, |
|
13599 rules: style |
|
13600 }); |
|
13601 } |
|
13602 /** |
|
13603 * Parse font-face. |
|
13604 */ |
|
13605 |
|
13606 |
|
13607 function atfontface() { |
|
13608 var pos = position(); |
|
13609 var m = match(/^@font-face\s*/); |
|
13610 |
|
13611 if (!m) { |
|
13612 return; |
|
13613 } |
|
13614 |
|
13615 if (!open()) { |
|
13616 return error("@font-face missing '{'"); |
|
13617 } |
|
13618 |
|
13619 var decls = comments(); // declarations |
|
13620 |
|
13621 var decl; // eslint-disable-next-line no-cond-assign |
|
13622 |
|
13623 while (decl = declaration()) { |
|
13624 decls.push(decl); |
|
13625 decls = decls.concat(comments()); |
|
13626 } |
|
13627 |
|
13628 if (!close()) { |
|
13629 return error("@font-face missing '}'"); |
|
13630 } |
|
13631 |
|
13632 return pos({ |
|
13633 type: 'font-face', |
|
13634 declarations: decls |
|
13635 }); |
|
13636 } |
|
13637 /** |
|
13638 * Parse import |
|
13639 */ |
|
13640 |
|
13641 |
|
13642 var atimport = _compileAtrule('import'); |
|
13643 /** |
|
13644 * Parse charset |
|
13645 */ |
|
13646 |
|
13647 |
|
13648 var atcharset = _compileAtrule('charset'); |
|
13649 /** |
|
13650 * Parse namespace |
|
13651 */ |
|
13652 |
|
13653 |
|
13654 var atnamespace = _compileAtrule('namespace'); |
|
13655 /** |
|
13656 * Parse non-block at-rules |
|
13657 */ |
|
13658 |
|
13659 |
|
13660 function _compileAtrule(name) { |
|
13661 var re = new RegExp('^@' + name + '\\s*([^;]+);'); |
|
13662 return function () { |
|
13663 var pos = position(); |
|
13664 var m = match(re); |
|
13665 |
|
13666 if (!m) { |
|
13667 return; |
|
13668 } |
|
13669 |
|
13670 var ret = { |
|
13671 type: name |
|
13672 }; |
|
13673 ret[name] = m[1].trim(); |
|
13674 return pos(ret); |
|
13675 }; |
|
13676 } |
|
13677 /** |
|
13678 * Parse at rule. |
|
13679 */ |
|
13680 |
|
13681 |
|
13682 function atrule() { |
|
13683 if (css[0] !== '@') { |
|
13684 return; |
|
13685 } |
|
13686 |
|
13687 return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface(); |
|
13688 } |
|
13689 /** |
|
13690 * Parse rule. |
|
13691 */ |
|
13692 |
|
13693 |
|
13694 function rule() { |
|
13695 var pos = position(); |
|
13696 var sel = selector(); |
|
13697 |
|
13698 if (!sel) { |
|
13699 return error('selector missing'); |
|
13700 } |
|
13701 |
|
13702 comments(); |
|
13703 return pos({ |
|
13704 type: 'rule', |
|
13705 selectors: sel, |
|
13706 declarations: declarations() |
|
13707 }); |
|
13708 } |
|
13709 |
|
13710 return addParent(stylesheet()); |
|
13711 }); |
|
13712 /** |
|
13713 * Trim `str`. |
|
13714 */ |
|
13715 |
|
13716 function trim(str) { |
|
13717 return str ? str.replace(/^\s+|\s+$/g, '') : ''; |
|
13718 } |
|
13719 /** |
|
13720 * Adds non-enumerable parent node reference to each node. |
|
13721 */ |
|
13722 |
|
13723 |
|
13724 function addParent(obj, parent) { |
|
13725 var isNode = obj && typeof obj.type === 'string'; |
|
13726 var childParent = isNode ? obj : parent; |
|
13727 |
|
13728 for (var k in obj) { |
|
13729 var value = obj[k]; |
|
13730 |
|
13731 if (Array.isArray(value)) { |
|
13732 value.forEach(function (v) { |
|
13733 addParent(v, childParent); |
|
13734 }); |
|
13735 } else if (value && Object(esm_typeof["a" /* default */])(value) === 'object') { |
|
13736 addParent(value, childParent); |
|
13737 } |
|
13738 } |
|
13739 |
|
13740 if (isNode) { |
|
13741 Object.defineProperty(obj, 'parent', { |
|
13742 configurable: true, |
|
13743 writable: true, |
|
13744 enumerable: false, |
|
13745 value: parent || null |
|
13746 }); |
|
13747 } |
|
13748 |
|
13749 return obj; |
|
13750 } |
|
13751 |
|
13752 // EXTERNAL MODULE: ./node_modules/inherits/inherits_browser.js |
|
13753 var inherits_browser = __webpack_require__(109); |
|
13754 var inherits_browser_default = /*#__PURE__*/__webpack_require__.n(inherits_browser); |
|
13755 |
|
13756 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/compiler.js |
|
13757 // Adapted from https://github.com/reworkcss/css |
|
13758 // because we needed to remove source map support. |
|
13759 |
|
13760 /** |
|
13761 * Expose `Compiler`. |
|
13762 */ |
|
13763 /* harmony default export */ var stringify_compiler = (Compiler); |
|
13764 /** |
|
13765 * Initialize a compiler. |
|
13766 * |
|
13767 * @param {Type} name |
|
13768 * @return {Type} |
|
13769 * @api public |
|
13770 */ |
|
13771 |
|
13772 function Compiler(opts) { |
|
13773 this.options = opts || {}; |
|
13774 } |
|
13775 /** |
|
13776 * Emit `str` |
|
13777 */ |
|
13778 |
|
13779 |
|
13780 Compiler.prototype.emit = function (str) { |
|
13781 return str; |
|
13782 }; |
|
13783 /** |
|
13784 * Visit `node`. |
|
13785 */ |
|
13786 |
|
13787 |
|
13788 Compiler.prototype.visit = function (node) { |
|
13789 return this[node.type](node); |
|
13790 }; |
|
13791 /** |
|
13792 * Map visit over array of `nodes`, optionally using a `delim` |
|
13793 */ |
|
13794 |
|
13795 |
|
13796 Compiler.prototype.mapVisit = function (nodes, delim) { |
|
13797 var buf = ''; |
|
13798 delim = delim || ''; |
|
13799 |
|
13800 for (var i = 0, length = nodes.length; i < length; i++) { |
|
13801 buf += this.visit(nodes[i]); |
|
13802 |
|
13803 if (delim && i < length - 1) { |
|
13804 buf += this.emit(delim); |
|
13805 } |
|
13806 } |
|
13807 |
|
13808 return buf; |
|
13809 }; |
|
13810 |
|
13811 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/compress.js |
|
13812 // Adapted from https://github.com/reworkcss/css |
|
13813 // because we needed to remove source map support. |
|
13814 |
13318 |
13815 /** |
13319 /** |
13816 * External dependencies |
13320 * External dependencies |
13817 */ |
13321 */ |
13818 |
13322 |
13819 /** |
13323 /** |
13820 * Internal dependencies |
|
13821 */ |
|
13822 |
|
13823 |
|
13824 /** |
|
13825 * Expose compiler. |
|
13826 */ |
|
13827 |
|
13828 /* harmony default export */ var compress = (compress_Compiler); |
|
13829 /** |
|
13830 * Initialize a new `Compiler`. |
|
13831 */ |
|
13832 |
|
13833 function compress_Compiler(options) { |
|
13834 stringify_compiler.call(this, options); |
|
13835 } |
|
13836 /** |
|
13837 * Inherit from `Base.prototype`. |
|
13838 */ |
|
13839 |
|
13840 |
|
13841 inherits_browser_default()(compress_Compiler, stringify_compiler); |
|
13842 /** |
|
13843 * Compile `node`. |
|
13844 */ |
|
13845 |
|
13846 compress_Compiler.prototype.compile = function (node) { |
|
13847 return node.stylesheet.rules.map(this.visit, this).join(''); |
|
13848 }; |
|
13849 /** |
|
13850 * Visit comment node. |
|
13851 */ |
|
13852 |
|
13853 |
|
13854 compress_Compiler.prototype.comment = function (node) { |
|
13855 return this.emit('', node.position); |
|
13856 }; |
|
13857 /** |
|
13858 * Visit import node. |
|
13859 */ |
|
13860 |
|
13861 |
|
13862 compress_Compiler.prototype.import = function (node) { |
|
13863 return this.emit('@import ' + node.import + ';', node.position); |
|
13864 }; |
|
13865 /** |
|
13866 * Visit media node. |
|
13867 */ |
|
13868 |
|
13869 |
|
13870 compress_Compiler.prototype.media = function (node) { |
|
13871 return this.emit('@media ' + node.media, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); |
|
13872 }; |
|
13873 /** |
|
13874 * Visit document node. |
|
13875 */ |
|
13876 |
|
13877 |
|
13878 compress_Compiler.prototype.document = function (node) { |
|
13879 var doc = '@' + (node.vendor || '') + 'document ' + node.document; |
|
13880 return this.emit(doc, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); |
|
13881 }; |
|
13882 /** |
|
13883 * Visit charset node. |
|
13884 */ |
|
13885 |
|
13886 |
|
13887 compress_Compiler.prototype.charset = function (node) { |
|
13888 return this.emit('@charset ' + node.charset + ';', node.position); |
|
13889 }; |
|
13890 /** |
|
13891 * Visit namespace node. |
|
13892 */ |
|
13893 |
|
13894 |
|
13895 compress_Compiler.prototype.namespace = function (node) { |
|
13896 return this.emit('@namespace ' + node.namespace + ';', node.position); |
|
13897 }; |
|
13898 /** |
|
13899 * Visit supports node. |
|
13900 */ |
|
13901 |
|
13902 |
|
13903 compress_Compiler.prototype.supports = function (node) { |
|
13904 return this.emit('@supports ' + node.supports, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); |
|
13905 }; |
|
13906 /** |
|
13907 * Visit keyframes node. |
|
13908 */ |
|
13909 |
|
13910 |
|
13911 compress_Compiler.prototype.keyframes = function (node) { |
|
13912 return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit('{') + this.mapVisit(node.keyframes) + this.emit('}'); |
|
13913 }; |
|
13914 /** |
|
13915 * Visit keyframe node. |
|
13916 */ |
|
13917 |
|
13918 |
|
13919 compress_Compiler.prototype.keyframe = function (node) { |
|
13920 var decls = node.declarations; |
|
13921 return this.emit(node.values.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}'); |
|
13922 }; |
|
13923 /** |
|
13924 * Visit page node. |
|
13925 */ |
|
13926 |
|
13927 |
|
13928 compress_Compiler.prototype.page = function (node) { |
|
13929 var sel = node.selectors.length ? node.selectors.join(', ') : ''; |
|
13930 return this.emit('@page ' + sel, node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}'); |
|
13931 }; |
|
13932 /** |
|
13933 * Visit font-face node. |
|
13934 */ |
|
13935 |
|
13936 |
|
13937 compress_Compiler.prototype['font-face'] = function (node) { |
|
13938 return this.emit('@font-face', node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}'); |
|
13939 }; |
|
13940 /** |
|
13941 * Visit host node. |
|
13942 */ |
|
13943 |
|
13944 |
|
13945 compress_Compiler.prototype.host = function (node) { |
|
13946 return this.emit('@host', node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); |
|
13947 }; |
|
13948 /** |
|
13949 * Visit custom-media node. |
|
13950 */ |
|
13951 |
|
13952 |
|
13953 compress_Compiler.prototype['custom-media'] = function (node) { |
|
13954 return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); |
|
13955 }; |
|
13956 /** |
|
13957 * Visit rule node. |
|
13958 */ |
|
13959 |
|
13960 |
|
13961 compress_Compiler.prototype.rule = function (node) { |
|
13962 var decls = node.declarations; |
|
13963 |
|
13964 if (!decls.length) { |
|
13965 return ''; |
|
13966 } |
|
13967 |
|
13968 return this.emit(node.selectors.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}'); |
|
13969 }; |
|
13970 /** |
|
13971 * Visit declaration node. |
|
13972 */ |
|
13973 |
|
13974 |
|
13975 compress_Compiler.prototype.declaration = function (node) { |
|
13976 return this.emit(node.property + ':' + node.value, node.position) + this.emit(';'); |
|
13977 }; |
|
13978 |
|
13979 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/identity.js |
|
13980 /* eslint-disable @wordpress/no-unused-vars-before-return */ |
|
13981 // Adapted from https://github.com/reworkcss/css |
|
13982 // because we needed to remove source map support. |
|
13983 |
|
13984 /** |
|
13985 * External dependencies |
|
13986 */ |
|
13987 |
|
13988 /** |
|
13989 * Internal dependencies |
|
13990 */ |
|
13991 |
|
13992 |
|
13993 /** |
|
13994 * Expose compiler. |
|
13995 */ |
|
13996 |
|
13997 /* harmony default export */ var identity = (identity_Compiler); |
|
13998 /** |
|
13999 * Initialize a new `Compiler`. |
|
14000 */ |
|
14001 |
|
14002 function identity_Compiler(options) { |
|
14003 options = options || {}; |
|
14004 stringify_compiler.call(this, options); |
|
14005 this.indentation = options.indent; |
|
14006 } |
|
14007 /** |
|
14008 * Inherit from `Base.prototype`. |
|
14009 */ |
|
14010 |
|
14011 |
|
14012 inherits_browser_default()(identity_Compiler, stringify_compiler); |
|
14013 /** |
|
14014 * Compile `node`. |
|
14015 */ |
|
14016 |
|
14017 identity_Compiler.prototype.compile = function (node) { |
|
14018 return this.stylesheet(node); |
|
14019 }; |
|
14020 /** |
|
14021 * Visit stylesheet node. |
|
14022 */ |
|
14023 |
|
14024 |
|
14025 identity_Compiler.prototype.stylesheet = function (node) { |
|
14026 return this.mapVisit(node.stylesheet.rules, '\n\n'); |
|
14027 }; |
|
14028 /** |
|
14029 * Visit comment node. |
|
14030 */ |
|
14031 |
|
14032 |
|
14033 identity_Compiler.prototype.comment = function (node) { |
|
14034 return this.emit(this.indent() + '/*' + node.comment + '*/', node.position); |
|
14035 }; |
|
14036 /** |
|
14037 * Visit import node. |
|
14038 */ |
|
14039 |
|
14040 |
|
14041 identity_Compiler.prototype.import = function (node) { |
|
14042 return this.emit('@import ' + node.import + ';', node.position); |
|
14043 }; |
|
14044 /** |
|
14045 * Visit media node. |
|
14046 */ |
|
14047 |
|
14048 |
|
14049 identity_Compiler.prototype.media = function (node) { |
|
14050 return this.emit('@media ' + node.media, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); |
|
14051 }; |
|
14052 /** |
|
14053 * Visit document node. |
|
14054 */ |
|
14055 |
|
14056 |
|
14057 identity_Compiler.prototype.document = function (node) { |
|
14058 var doc = '@' + (node.vendor || '') + 'document ' + node.document; |
|
14059 return this.emit(doc, node.position) + this.emit(' ' + ' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); |
|
14060 }; |
|
14061 /** |
|
14062 * Visit charset node. |
|
14063 */ |
|
14064 |
|
14065 |
|
14066 identity_Compiler.prototype.charset = function (node) { |
|
14067 return this.emit('@charset ' + node.charset + ';', node.position); |
|
14068 }; |
|
14069 /** |
|
14070 * Visit namespace node. |
|
14071 */ |
|
14072 |
|
14073 |
|
14074 identity_Compiler.prototype.namespace = function (node) { |
|
14075 return this.emit('@namespace ' + node.namespace + ';', node.position); |
|
14076 }; |
|
14077 /** |
|
14078 * Visit supports node. |
|
14079 */ |
|
14080 |
|
14081 |
|
14082 identity_Compiler.prototype.supports = function (node) { |
|
14083 return this.emit('@supports ' + node.supports, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); |
|
14084 }; |
|
14085 /** |
|
14086 * Visit keyframes node. |
|
14087 */ |
|
14088 |
|
14089 |
|
14090 identity_Compiler.prototype.keyframes = function (node) { |
|
14091 return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.keyframes, '\n') + this.emit(this.indent(-1) + '}'); |
|
14092 }; |
|
14093 /** |
|
14094 * Visit keyframe node. |
|
14095 */ |
|
14096 |
|
14097 |
|
14098 identity_Compiler.prototype.keyframe = function (node) { |
|
14099 var decls = node.declarations; |
|
14100 return this.emit(this.indent()) + this.emit(node.values.join(', '), node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1) + '\n' + this.indent() + '}\n'); |
|
14101 }; |
|
14102 /** |
|
14103 * Visit page node. |
|
14104 */ |
|
14105 |
|
14106 |
|
14107 identity_Compiler.prototype.page = function (node) { |
|
14108 var sel = node.selectors.length ? node.selectors.join(', ') + ' ' : ''; |
|
14109 return this.emit('@page ' + sel, node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}'); |
|
14110 }; |
|
14111 /** |
|
14112 * Visit font-face node. |
|
14113 */ |
|
14114 |
|
14115 |
|
14116 identity_Compiler.prototype['font-face'] = function (node) { |
|
14117 return this.emit('@font-face ', node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}'); |
|
14118 }; |
|
14119 /** |
|
14120 * Visit host node. |
|
14121 */ |
|
14122 |
|
14123 |
|
14124 identity_Compiler.prototype.host = function (node) { |
|
14125 return this.emit('@host', node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); |
|
14126 }; |
|
14127 /** |
|
14128 * Visit custom-media node. |
|
14129 */ |
|
14130 |
|
14131 |
|
14132 identity_Compiler.prototype['custom-media'] = function (node) { |
|
14133 return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); |
|
14134 }; |
|
14135 /** |
|
14136 * Visit rule node. |
|
14137 */ |
|
14138 |
|
14139 |
|
14140 identity_Compiler.prototype.rule = function (node) { |
|
14141 var indent = this.indent(); |
|
14142 var decls = node.declarations; |
|
14143 |
|
14144 if (!decls.length) { |
|
14145 return ''; |
|
14146 } |
|
14147 |
|
14148 return this.emit(node.selectors.map(function (s) { |
|
14149 return indent + s; |
|
14150 }).join(',\n'), node.position) + this.emit(' {\n') + this.emit(this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1)) + this.emit('\n' + this.indent() + '}'); |
|
14151 }; |
|
14152 /** |
|
14153 * Visit declaration node. |
|
14154 */ |
|
14155 |
|
14156 |
|
14157 identity_Compiler.prototype.declaration = function (node) { |
|
14158 return this.emit(this.indent()) + this.emit(node.property + ': ' + node.value, node.position) + this.emit(';'); |
|
14159 }; |
|
14160 /** |
|
14161 * Increase, decrease or return current indentation. |
|
14162 */ |
|
14163 |
|
14164 |
|
14165 identity_Compiler.prototype.indent = function (level) { |
|
14166 this.level = this.level || 1; |
|
14167 |
|
14168 if (null !== level) { |
|
14169 this.level += level; |
|
14170 return ''; |
|
14171 } |
|
14172 |
|
14173 return Array(this.level).join(this.indentation || ' '); |
|
14174 }; |
|
14175 |
|
14176 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/index.js |
|
14177 // Adapted from https://github.com/reworkcss/css |
|
14178 // because we needed to remove source map support. |
|
14179 |
|
14180 /** |
|
14181 * Internal dependencies |
|
14182 */ |
|
14183 |
|
14184 |
|
14185 /** |
|
14186 * Stringfy the given AST `node`. |
|
14187 * |
|
14188 * Options: |
|
14189 * |
|
14190 * - `compress` space-optimized output |
|
14191 * - `sourcemap` return an object with `.code` and `.map` |
|
14192 * |
|
14193 * @param {Object} node |
|
14194 * @param {Object} [options] |
|
14195 * @return {String} |
|
14196 * @api public |
|
14197 */ |
|
14198 |
|
14199 /* harmony default export */ var stringify = (function (node, options) { |
|
14200 options = options || {}; |
|
14201 var compiler = options.compress ? new compress(options) : new identity(options); |
|
14202 var code = compiler.compile(node); |
|
14203 return code; |
|
14204 }); |
|
14205 |
|
14206 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/index.js |
|
14207 // Adapted from https://github.com/reworkcss/css |
|
14208 // because we needed to remove source map support. |
|
14209 |
|
14210 |
|
14211 |
|
14212 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/traverse.js |
|
14213 /** |
|
14214 * External dependencies |
|
14215 */ |
|
14216 |
|
14217 /** |
|
14218 * Internal dependencies |
|
14219 */ |
|
14220 |
|
14221 |
|
14222 |
|
14223 function traverseCSS(css, callback) { |
|
14224 try { |
|
14225 var parsed = parse(css); |
|
14226 var updated = traverse_default.a.map(parsed, function (node) { |
|
14227 if (!node) { |
|
14228 return node; |
|
14229 } |
|
14230 |
|
14231 var updatedNode = callback(node); |
|
14232 return this.update(updatedNode); |
|
14233 }); |
|
14234 return stringify(updated); |
|
14235 } catch (err) { |
|
14236 // eslint-disable-next-line no-console |
|
14237 console.warn('Error while traversing the CSS: ' + err); |
|
14238 return null; |
|
14239 } |
|
14240 } |
|
14241 |
|
14242 /* harmony default export */ var editor_styles_traverse = (traverseCSS); |
|
14243 |
|
14244 // EXTERNAL MODULE: ./node_modules/url/url.js |
|
14245 var url = __webpack_require__(84); |
|
14246 |
|
14247 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/transforms/url-rewrite.js |
|
14248 |
|
14249 |
|
14250 /** |
|
14251 * External dependencies |
|
14252 */ |
|
14253 |
|
14254 /** |
|
14255 * Return `true` if the given path is http/https. |
|
14256 * |
|
14257 * @param {string} filePath path |
|
14258 * |
|
14259 * @return {boolean} is remote path. |
|
14260 */ |
|
14261 |
|
14262 function isRemotePath(filePath) { |
|
14263 return /^(?:https?:)?\/\//.test(filePath); |
|
14264 } |
|
14265 /** |
|
14266 * Return `true` if the given filePath is an absolute url. |
|
14267 * |
|
14268 * @param {string} filePath path |
|
14269 * |
|
14270 * @return {boolean} is absolute path. |
|
14271 */ |
|
14272 |
|
14273 |
|
14274 function isAbsolutePath(filePath) { |
|
14275 return /^\/(?!\/)/.test(filePath); |
|
14276 } |
|
14277 /** |
|
14278 * Whether or not the url should be inluded. |
|
14279 * |
|
14280 * @param {Object} meta url meta info |
|
14281 * |
|
14282 * @return {boolean} is valid. |
|
14283 */ |
|
14284 |
|
14285 |
|
14286 function isValidURL(meta) { |
|
14287 // ignore hashes or data uris |
|
14288 if (meta.value.indexOf('data:') === 0 || meta.value.indexOf('#') === 0) { |
|
14289 return false; |
|
14290 } |
|
14291 |
|
14292 if (isAbsolutePath(meta.value)) { |
|
14293 return false; |
|
14294 } // do not handle the http/https urls if `includeRemote` is false |
|
14295 |
|
14296 |
|
14297 if (isRemotePath(meta.value)) { |
|
14298 return false; |
|
14299 } |
|
14300 |
|
14301 return true; |
|
14302 } |
|
14303 /** |
|
14304 * Get the absolute path of the url, relative to the basePath |
|
14305 * |
|
14306 * @param {string} str the url |
|
14307 * @param {string} baseURL base URL |
|
14308 * @param {string} absolutePath the absolute path |
|
14309 * |
|
14310 * @return {string} the full path to the file |
|
14311 */ |
|
14312 |
|
14313 |
|
14314 function getResourcePath(str, baseURL) { |
|
14315 var pathname = Object(url["parse"])(str).pathname; |
|
14316 var filePath = Object(url["resolve"])(baseURL, pathname); |
|
14317 return filePath; |
|
14318 } |
|
14319 /** |
|
14320 * Process the single `url()` pattern |
|
14321 * |
|
14322 * @param {string} baseURL the base URL for relative URLs |
|
14323 * @return {Promise} the Promise |
|
14324 */ |
|
14325 |
|
14326 |
|
14327 function processURL(baseURL) { |
|
14328 return function (meta) { |
|
14329 var URL = getResourcePath(meta.value, baseURL); |
|
14330 return Object(objectSpread["a" /* default */])({}, meta, { |
|
14331 newUrl: 'url(' + meta.before + meta.quote + URL + meta.quote + meta.after + ')' |
|
14332 }); |
|
14333 }; |
|
14334 } |
|
14335 /** |
|
14336 * Get all `url()`s, and return the meta info |
|
14337 * |
|
14338 * @param {string} value decl.value |
|
14339 * |
|
14340 * @return {Array} the urls |
|
14341 */ |
|
14342 |
|
14343 |
|
14344 function getURLs(value) { |
|
14345 var reg = /url\((\s*)(['"]?)(.+?)\2(\s*)\)/g; |
|
14346 var match; |
|
14347 var URLs = []; |
|
14348 |
|
14349 while ((match = reg.exec(value)) !== null) { |
|
14350 var meta = { |
|
14351 source: match[0], |
|
14352 before: match[1], |
|
14353 quote: match[2], |
|
14354 value: match[3], |
|
14355 after: match[4] |
|
14356 }; |
|
14357 |
|
14358 if (isValidURL(meta)) { |
|
14359 URLs.push(meta); |
|
14360 } |
|
14361 } |
|
14362 |
|
14363 return URLs; |
|
14364 } |
|
14365 /** |
|
14366 * Replace the raw value's `url()` segment to the new value |
|
14367 * |
|
14368 * @param {string} raw the raw value |
|
14369 * @param {Array} URLs the URLs to replace |
|
14370 * |
|
14371 * @return {string} the new value |
|
14372 */ |
|
14373 |
|
14374 |
|
14375 function replaceURLs(raw, URLs) { |
|
14376 URLs.forEach(function (item) { |
|
14377 raw = raw.replace(item.source, item.newUrl); |
|
14378 }); |
|
14379 return raw; |
|
14380 } |
|
14381 |
|
14382 var url_rewrite_rewrite = function rewrite(rootURL) { |
|
14383 return function (node) { |
|
14384 if (node.type === 'declaration') { |
|
14385 var updatedURLs = getURLs(node.value).map(processURL(rootURL)); |
|
14386 return Object(objectSpread["a" /* default */])({}, node, { |
|
14387 value: replaceURLs(node.value, updatedURLs) |
|
14388 }); |
|
14389 } |
|
14390 |
|
14391 return node; |
|
14392 }; |
|
14393 }; |
|
14394 |
|
14395 /* harmony default export */ var url_rewrite = (url_rewrite_rewrite); |
|
14396 |
|
14397 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/transforms/wrap.js |
|
14398 |
|
14399 |
|
14400 /** |
|
14401 * External dependencies |
|
14402 */ |
|
14403 |
|
14404 /** |
|
14405 * @const string IS_ROOT_TAG Regex to check if the selector is a root tag selector. |
|
14406 */ |
|
14407 |
|
14408 var IS_ROOT_TAG = /^(body|html|:root).*$/; |
|
14409 |
|
14410 var wrap_wrap = function wrap(namespace) { |
|
14411 var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
|
14412 return function (node) { |
|
14413 var updateSelector = function updateSelector(selector) { |
|
14414 if (Object(external_lodash_["includes"])(ignore, selector.trim())) { |
|
14415 return selector; |
|
14416 } // Anything other than a root tag is always prefixed. |
|
14417 |
|
14418 |
|
14419 { |
|
14420 if (!selector.match(IS_ROOT_TAG)) { |
|
14421 return namespace + ' ' + selector; |
|
14422 } |
|
14423 } // HTML and Body elements cannot be contained within our container so lets extract their styles. |
|
14424 |
|
14425 return selector.replace(/^(body|html|:root)/, namespace); |
|
14426 }; |
|
14427 |
|
14428 if (node.type === 'rule') { |
|
14429 return Object(objectSpread["a" /* default */])({}, node, { |
|
14430 selectors: node.selectors.map(updateSelector) |
|
14431 }); |
|
14432 } |
|
14433 |
|
14434 return node; |
|
14435 }; |
|
14436 }; |
|
14437 |
|
14438 /* harmony default export */ var transforms_wrap = (wrap_wrap); |
|
14439 |
|
14440 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/index.js |
|
14441 /** |
|
14442 * External dependencies |
|
14443 */ |
|
14444 |
|
14445 /** |
|
14446 * WordPress dependencies |
13324 * WordPress dependencies |
14447 */ |
13325 */ |
14448 |
13326 |
14449 |
|
14450 /** |
|
14451 * Internal dependencies |
|
14452 */ |
|
14453 |
|
14454 |
|
14455 |
|
14456 |
|
14457 /** |
|
14458 * Convert css rules. |
|
14459 * |
|
14460 * @param {Array} styles CSS rules. |
|
14461 * @param {string} wrapperClassName Wrapper Class Name. |
|
14462 * @return {Array} converted rules. |
|
14463 */ |
|
14464 |
|
14465 var editor_styles_transformStyles = function transformStyles(styles) { |
|
14466 var wrapperClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; |
|
14467 return Object(external_lodash_["map"])(styles, function (_ref) { |
|
14468 var css = _ref.css, |
|
14469 baseURL = _ref.baseURL; |
|
14470 var transforms = []; |
|
14471 |
|
14472 if (wrapperClassName) { |
|
14473 transforms.push(transforms_wrap(wrapperClassName)); |
|
14474 } |
|
14475 |
|
14476 if (baseURL) { |
|
14477 transforms.push(url_rewrite(baseURL)); |
|
14478 } |
|
14479 |
|
14480 if (transforms.length) { |
|
14481 return editor_styles_traverse(css, Object(external_this_wp_compose_["compose"])(transforms)); |
|
14482 } |
|
14483 |
|
14484 return css; |
|
14485 }); |
|
14486 }; |
|
14487 |
|
14488 /* harmony default export */ var editor_styles = (editor_styles_transformStyles); |
|
14489 |
|
14490 // EXTERNAL MODULE: external {"this":["wp","blob"]} |
|
14491 var external_this_wp_blob_ = __webpack_require__(35); |
|
14492 |
|
14493 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/media-upload.js |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 |
|
14500 |
|
14501 /** |
|
14502 * External dependencies |
|
14503 */ |
|
14504 |
|
14505 /** |
|
14506 * WordPress dependencies |
|
14507 */ |
|
14508 |
|
14509 |
|
14510 |
|
14511 |
|
14512 /** |
|
14513 * Browsers may use unexpected mime types, and they differ from browser to browser. |
|
14514 * This function computes a flexible array of mime types from the mime type structured provided by the server. |
|
14515 * Converts { jpg|jpeg|jpe: "image/jpeg" } into [ "image/jpeg", "image/jpg", "image/jpeg", "image/jpe" ] |
|
14516 * The computation of this array instead of directly using the object, |
|
14517 * solves the problem in chrome where mp3 files have audio/mp3 as mime type instead of audio/mpeg. |
|
14518 * https://bugs.chromium.org/p/chromium/issues/detail?id=227004 |
|
14519 * |
|
14520 * @param {?Object} wpMimeTypesObject Mime type object received from the server. |
|
14521 * Extensions are keys separated by '|' and values are mime types associated with an extension. |
|
14522 * |
|
14523 * @return {?Array} An array of mime types or the parameter passed if it was "falsy". |
|
14524 */ |
|
14525 |
|
14526 function getMimeTypesArray(wpMimeTypesObject) { |
|
14527 if (!wpMimeTypesObject) { |
|
14528 return wpMimeTypesObject; |
|
14529 } |
|
14530 |
|
14531 return Object(external_lodash_["flatMap"])(wpMimeTypesObject, function (mime, extensionsString) { |
|
14532 var _mime$split = mime.split('/'), |
|
14533 _mime$split2 = Object(slicedToArray["a" /* default */])(_mime$split, 1), |
|
14534 type = _mime$split2[0]; |
|
14535 |
|
14536 var extensions = extensionsString.split('|'); |
|
14537 return [mime].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["map"])(extensions, function (extension) { |
|
14538 return "".concat(type, "/").concat(extension); |
|
14539 }))); |
|
14540 }); |
|
14541 } |
|
14542 /** |
|
14543 * Media Upload is used by audio, image, gallery, video, and file blocks to |
|
14544 * handle uploading a media file when a file upload button is activated. |
|
14545 * |
|
14546 * TODO: future enhancement to add an upload indicator. |
|
14547 * |
|
14548 * @param {Object} $0 Parameters object passed to the function. |
|
14549 * @param {?Array} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. |
|
14550 * @param {?Object} $0.additionalData Additional data to include in the request. |
|
14551 * @param {Array} $0.filesList List of files. |
|
14552 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. |
|
14553 * @param {Function} $0.onError Function called when an error happens. |
|
14554 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. |
|
14555 * @param {?Object} $0.wpAllowedMimeTypes List of allowed mime types and file extensions. |
|
14556 */ |
|
14557 |
|
14558 function mediaUpload(_x) { |
|
14559 return _mediaUpload.apply(this, arguments); |
|
14560 } |
|
14561 /** |
|
14562 * @param {File} file Media File to Save. |
|
14563 * @param {?Object} additionalData Additional data to include in the request. |
|
14564 * |
|
14565 * @return {Promise} Media Object Promise. |
|
14566 */ |
|
14567 |
|
14568 function _mediaUpload() { |
|
14569 _mediaUpload = Object(asyncToGenerator["a" /* default */])( |
|
14570 /*#__PURE__*/ |
|
14571 regenerator_default.a.mark(function _callee(_ref) { |
|
14572 var allowedTypes, _ref$additionalData, additionalData, filesList, maxUploadFileSize, _ref$onError, onError, onFileChange, _ref$wpAllowedMimeTyp, wpAllowedMimeTypes, files, filesSet, setAndUpdateFiles, isAllowedType, allowedMimeTypesForUser, isAllowedMimeTypeForUser, triggerError, validFiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _mediaFile, idx, mediaFile, savedMedia, mediaObject, message; |
|
14573 |
|
14574 return regenerator_default.a.wrap(function _callee$(_context) { |
|
14575 while (1) { |
|
14576 switch (_context.prev = _context.next) { |
|
14577 case 0: |
|
14578 allowedTypes = _ref.allowedTypes, _ref$additionalData = _ref.additionalData, additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData, filesList = _ref.filesList, maxUploadFileSize = _ref.maxUploadFileSize, _ref$onError = _ref.onError, onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError, onFileChange = _ref.onFileChange, _ref$wpAllowedMimeTyp = _ref.wpAllowedMimeTypes, wpAllowedMimeTypes = _ref$wpAllowedMimeTyp === void 0 ? null : _ref$wpAllowedMimeTyp; |
|
14579 // Cast filesList to array |
|
14580 files = Object(toConsumableArray["a" /* default */])(filesList); |
|
14581 filesSet = []; |
|
14582 |
|
14583 setAndUpdateFiles = function setAndUpdateFiles(idx, value) { |
|
14584 Object(external_this_wp_blob_["revokeBlobURL"])(Object(external_lodash_["get"])(filesSet, [idx, 'url'])); |
|
14585 filesSet[idx] = value; |
|
14586 onFileChange(Object(external_lodash_["compact"])(filesSet)); |
|
14587 }; // Allowed type specified by consumer |
|
14588 |
|
14589 |
|
14590 isAllowedType = function isAllowedType(fileType) { |
|
14591 if (!allowedTypes) { |
|
14592 return true; |
|
14593 } |
|
14594 |
|
14595 return Object(external_lodash_["some"])(allowedTypes, function (allowedType) { |
|
14596 // If a complete mimetype is specified verify if it matches exactly the mime type of the file. |
|
14597 if (Object(external_lodash_["includes"])(allowedType, '/')) { |
|
14598 return allowedType === fileType; |
|
14599 } // Otherwise a general mime type is used and we should verify if the file mimetype starts with it. |
|
14600 |
|
14601 |
|
14602 return Object(external_lodash_["startsWith"])(fileType, "".concat(allowedType, "/")); |
|
14603 }); |
|
14604 }; // Allowed types for the current WP_User |
|
14605 |
|
14606 |
|
14607 allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); |
|
14608 |
|
14609 isAllowedMimeTypeForUser = function isAllowedMimeTypeForUser(fileType) { |
|
14610 return Object(external_lodash_["includes"])(allowedMimeTypesForUser, fileType); |
|
14611 }; // Build the error message including the filename |
|
14612 |
|
14613 |
|
14614 triggerError = function triggerError(error) { |
|
14615 error.message = [Object(external_this_wp_element_["createElement"])("strong", { |
|
14616 key: "filename" |
|
14617 }, error.file.name), ': ', error.message]; |
|
14618 onError(error); |
|
14619 }; |
|
14620 |
|
14621 validFiles = []; |
|
14622 _iteratorNormalCompletion = true; |
|
14623 _didIteratorError = false; |
|
14624 _iteratorError = undefined; |
|
14625 _context.prev = 12; |
|
14626 _iterator = files[Symbol.iterator](); |
|
14627 |
|
14628 case 14: |
|
14629 if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { |
|
14630 _context.next = 34; |
|
14631 break; |
|
14632 } |
|
14633 |
|
14634 _mediaFile = _step.value; |
|
14635 |
|
14636 if (!(allowedMimeTypesForUser && !isAllowedMimeTypeForUser(_mediaFile.type))) { |
|
14637 _context.next = 19; |
|
14638 break; |
|
14639 } |
|
14640 |
|
14641 triggerError({ |
|
14642 code: 'MIME_TYPE_NOT_ALLOWED_FOR_USER', |
|
14643 message: Object(external_this_wp_i18n_["__"])('Sorry, this file type is not permitted for security reasons.'), |
|
14644 file: _mediaFile |
|
14645 }); |
|
14646 return _context.abrupt("continue", 31); |
|
14647 |
|
14648 case 19: |
|
14649 if (isAllowedType(_mediaFile.type)) { |
|
14650 _context.next = 22; |
|
14651 break; |
|
14652 } |
|
14653 |
|
14654 triggerError({ |
|
14655 code: 'MIME_TYPE_NOT_SUPPORTED', |
|
14656 message: Object(external_this_wp_i18n_["__"])('Sorry, this file type is not supported here.'), |
|
14657 file: _mediaFile |
|
14658 }); |
|
14659 return _context.abrupt("continue", 31); |
|
14660 |
|
14661 case 22: |
|
14662 if (!(maxUploadFileSize && _mediaFile.size > maxUploadFileSize)) { |
|
14663 _context.next = 25; |
|
14664 break; |
|
14665 } |
|
14666 |
|
14667 triggerError({ |
|
14668 code: 'SIZE_ABOVE_LIMIT', |
|
14669 message: Object(external_this_wp_i18n_["__"])('This file exceeds the maximum upload size for this site.'), |
|
14670 file: _mediaFile |
|
14671 }); |
|
14672 return _context.abrupt("continue", 31); |
|
14673 |
|
14674 case 25: |
|
14675 if (!(_mediaFile.size <= 0)) { |
|
14676 _context.next = 28; |
|
14677 break; |
|
14678 } |
|
14679 |
|
14680 triggerError({ |
|
14681 code: 'EMPTY_FILE', |
|
14682 message: Object(external_this_wp_i18n_["__"])('This file is empty.'), |
|
14683 file: _mediaFile |
|
14684 }); |
|
14685 return _context.abrupt("continue", 31); |
|
14686 |
|
14687 case 28: |
|
14688 validFiles.push(_mediaFile); // Set temporary URL to create placeholder media file, this is replaced |
|
14689 // with final file from media gallery when upload is `done` below |
|
14690 |
|
14691 filesSet.push({ |
|
14692 url: Object(external_this_wp_blob_["createBlobURL"])(_mediaFile) |
|
14693 }); |
|
14694 onFileChange(filesSet); |
|
14695 |
|
14696 case 31: |
|
14697 _iteratorNormalCompletion = true; |
|
14698 _context.next = 14; |
|
14699 break; |
|
14700 |
|
14701 case 34: |
|
14702 _context.next = 40; |
|
14703 break; |
|
14704 |
|
14705 case 36: |
|
14706 _context.prev = 36; |
|
14707 _context.t0 = _context["catch"](12); |
|
14708 _didIteratorError = true; |
|
14709 _iteratorError = _context.t0; |
|
14710 |
|
14711 case 40: |
|
14712 _context.prev = 40; |
|
14713 _context.prev = 41; |
|
14714 |
|
14715 if (!_iteratorNormalCompletion && _iterator.return != null) { |
|
14716 _iterator.return(); |
|
14717 } |
|
14718 |
|
14719 case 43: |
|
14720 _context.prev = 43; |
|
14721 |
|
14722 if (!_didIteratorError) { |
|
14723 _context.next = 46; |
|
14724 break; |
|
14725 } |
|
14726 |
|
14727 throw _iteratorError; |
|
14728 |
|
14729 case 46: |
|
14730 return _context.finish(43); |
|
14731 |
|
14732 case 47: |
|
14733 return _context.finish(40); |
|
14734 |
|
14735 case 48: |
|
14736 idx = 0; |
|
14737 |
|
14738 case 49: |
|
14739 if (!(idx < validFiles.length)) { |
|
14740 _context.next = 68; |
|
14741 break; |
|
14742 } |
|
14743 |
|
14744 mediaFile = validFiles[idx]; |
|
14745 _context.prev = 51; |
|
14746 _context.next = 54; |
|
14747 return createMediaFromFile(mediaFile, additionalData); |
|
14748 |
|
14749 case 54: |
|
14750 savedMedia = _context.sent; |
|
14751 mediaObject = Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(savedMedia, ['alt_text', 'source_url']), { |
|
14752 alt: savedMedia.alt_text, |
|
14753 caption: Object(external_lodash_["get"])(savedMedia, ['caption', 'raw'], ''), |
|
14754 title: savedMedia.title.raw, |
|
14755 url: savedMedia.source_url |
|
14756 }); |
|
14757 setAndUpdateFiles(idx, mediaObject); |
|
14758 _context.next = 65; |
|
14759 break; |
|
14760 |
|
14761 case 59: |
|
14762 _context.prev = 59; |
|
14763 _context.t1 = _context["catch"](51); |
|
14764 // Reset to empty on failure. |
|
14765 setAndUpdateFiles(idx, null); |
|
14766 message = void 0; |
|
14767 |
|
14768 if (Object(external_lodash_["has"])(_context.t1, ['message'])) { |
|
14769 message = Object(external_lodash_["get"])(_context.t1, ['message']); |
|
14770 } else { |
|
14771 message = Object(external_this_wp_i18n_["sprintf"])( // translators: %s: file name |
|
14772 Object(external_this_wp_i18n_["__"])('Error while uploading file %s to the media library.'), mediaFile.name); |
|
14773 } |
|
14774 |
|
14775 onError({ |
|
14776 code: 'GENERAL', |
|
14777 message: message, |
|
14778 file: mediaFile |
|
14779 }); |
|
14780 |
|
14781 case 65: |
|
14782 ++idx; |
|
14783 _context.next = 49; |
|
14784 break; |
|
14785 |
|
14786 case 68: |
|
14787 case "end": |
|
14788 return _context.stop(); |
|
14789 } |
|
14790 } |
|
14791 }, _callee, this, [[12, 36, 40, 48], [41,, 43, 47], [51, 59]]); |
|
14792 })); |
|
14793 return _mediaUpload.apply(this, arguments); |
|
14794 } |
|
14795 |
|
14796 function createMediaFromFile(file, additionalData) { |
|
14797 // Create upload payload |
|
14798 var data = new window.FormData(); |
|
14799 data.append('file', file, file.name || file.type.replace('/', '.')); |
|
14800 Object(external_lodash_["forEach"])(additionalData, function (value, key) { |
|
14801 return data.append(key, value); |
|
14802 }); |
|
14803 return external_this_wp_apiFetch_default()({ |
|
14804 path: '/wp/v2/media', |
|
14805 body: data, |
|
14806 method: 'POST' |
|
14807 }); |
|
14808 } |
|
14809 |
|
14810 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js |
|
14811 |
|
14812 |
|
14813 /** |
|
14814 * External dependencies |
|
14815 */ |
|
14816 |
|
14817 /** |
|
14818 * WordPress dependencies |
|
14819 */ |
|
14820 |
|
14821 |
|
14822 /** |
|
14823 * Internal dependencies |
|
14824 */ |
|
14825 |
13327 |
14826 |
13328 |
14827 /** |
13329 /** |
14828 * Upload a media file when the file upload button is activated. |
13330 * Upload a media file when the file upload button is activated. |
14829 * Wrapper around mediaUpload() that injects the current post ID. |
13331 * Wrapper around mediaUpload() that injects the current post ID. |
14835 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. |
13337 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. |
14836 * @param {Function} $0.onError Function called when an error happens. |
13338 * @param {Function} $0.onError Function called when an error happens. |
14837 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. |
13339 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. |
14838 */ |
13340 */ |
14839 |
13341 |
14840 /* harmony default export */ var media_upload = (function (_ref) { |
13342 function mediaUpload(_ref) { |
14841 var _ref$additionalData = _ref.additionalData, |
13343 var _ref$additionalData = _ref.additionalData, |
14842 additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData, |
13344 additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData, |
14843 allowedTypes = _ref.allowedTypes, |
13345 allowedTypes = _ref.allowedTypes, |
14844 filesList = _ref.filesList, |
13346 filesList = _ref.filesList, |
14845 maxUploadFileSize = _ref.maxUploadFileSize, |
13347 maxUploadFileSize = _ref.maxUploadFileSize, |
14846 _ref$onError = _ref.onError, |
13348 _ref$onError = _ref.onError, |
14847 _onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError, |
13349 _onError = _ref$onError === void 0 ? external_this_lodash_["noop"] : _ref$onError, |
14848 onFileChange = _ref.onFileChange; |
13350 onFileChange = _ref.onFileChange; |
14849 |
13351 |
14850 var _select = Object(external_this_wp_data_["select"])('core/editor'), |
13352 var _select = Object(external_this_wp_data_["select"])('core/editor'), |
14851 getCurrentPostId = _select.getCurrentPostId, |
13353 getCurrentPostId = _select.getCurrentPostId, |
14852 getEditorSettings = _select.getEditorSettings; |
13354 getEditorSettings = _select.getEditorSettings; |
14853 |
13355 |
14854 var wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; |
13356 var wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; |
14855 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; |
13357 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; |
14856 mediaUpload({ |
13358 Object(external_this_wp_mediaUtils_["uploadMedia"])({ |
14857 allowedTypes: allowedTypes, |
13359 allowedTypes: allowedTypes, |
14858 filesList: filesList, |
13360 filesList: filesList, |
14859 onFileChange: onFileChange, |
13361 onFileChange: onFileChange, |
14860 additionalData: Object(objectSpread["a" /* default */])({ |
13362 additionalData: media_upload_objectSpread({ |
14861 post: getCurrentPostId() |
13363 post: getCurrentPostId() |
14862 }, additionalData), |
13364 }, additionalData), |
14863 maxUploadFileSize: maxUploadFileSize, |
13365 maxUploadFileSize: maxUploadFileSize, |
14864 onError: function onError(_ref2) { |
13366 onError: function onError(_ref2) { |
14865 var message = _ref2.message; |
13367 var message = _ref2.message; |
14866 return _onError(message); |
13368 return _onError(message); |
14867 }, |
13369 }, |
14868 wpAllowedMimeTypes: wpAllowedMimeTypes |
13370 wpAllowedMimeTypes: wpAllowedMimeTypes |
14869 }); |
13371 }); |
14870 }); |
13372 } |
14871 |
13373 |
14872 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js |
13374 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/reusable-block-convert-button.js |
13375 |
|
13376 |
|
13377 /** |
|
13378 * External dependencies |
|
13379 */ |
|
13380 |
|
13381 /** |
|
13382 * WordPress dependencies |
|
13383 */ |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 function ReusableBlockConvertButton(_ref) { |
|
13392 var isVisible = _ref.isVisible, |
|
13393 isReusable = _ref.isReusable, |
|
13394 onConvertToStatic = _ref.onConvertToStatic, |
|
13395 onConvertToReusable = _ref.onConvertToReusable; |
|
13396 |
|
13397 if (!isVisible) { |
|
13398 return null; |
|
13399 } |
|
13400 |
|
13401 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSettingsMenuControls"], null, function (_ref2) { |
|
13402 var onClose = _ref2.onClose; |
|
13403 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, !isReusable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { |
|
13404 onClick: function onClick() { |
|
13405 onConvertToReusable(); |
|
13406 onClose(); |
|
13407 } |
|
13408 }, Object(external_this_wp_i18n_["__"])('Add to Reusable blocks')), isReusable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { |
|
13409 onClick: function onClick() { |
|
13410 onConvertToStatic(); |
|
13411 onClose(); |
|
13412 } |
|
13413 }, Object(external_this_wp_i18n_["__"])('Convert to Regular Block'))); |
|
13414 }); |
|
13415 } |
|
13416 /* harmony default export */ var reusable_block_convert_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { |
|
13417 var clientIds = _ref3.clientIds; |
|
13418 |
|
13419 var _select = select('core/block-editor'), |
|
13420 getBlocksByClientId = _select.getBlocksByClientId, |
|
13421 canInsertBlockType = _select.canInsertBlockType; |
|
13422 |
|
13423 var _select2 = select('core/editor'), |
|
13424 getReusableBlock = _select2.__experimentalGetReusableBlock; |
|
13425 |
|
13426 var _select3 = select('core'), |
|
13427 canUser = _select3.canUser; |
|
13428 |
|
13429 var blocks = getBlocksByClientId(clientIds); |
|
13430 var isReusable = blocks.length === 1 && blocks[0] && Object(external_this_wp_blocks_["isReusableBlock"])(blocks[0]) && !!getReusableBlock(blocks[0].attributes.ref); // Show 'Convert to Regular Block' when selected block is a reusable block |
|
13431 |
|
13432 var isVisible = isReusable || // Hide 'Add to Reusable blocks' when reusable blocks are disabled |
|
13433 canInsertBlockType('core/block') && Object(external_this_lodash_["every"])(blocks, function (block) { |
|
13434 return (// Guard against the case where a regular block has *just* been converted |
|
13435 !!block && // Hide 'Add to Reusable blocks' on invalid blocks |
|
13436 block.isValid && // Hide 'Add to Reusable blocks' when block doesn't support being made reusable |
|
13437 Object(external_this_wp_blocks_["hasBlockSupport"])(block.name, 'reusable', true) |
|
13438 ); |
|
13439 }) && // Hide 'Add to Reusable blocks' when current doesn't have permission to do that |
|
13440 !!canUser('create', 'blocks'); |
|
13441 return { |
|
13442 isReusable: isReusable, |
|
13443 isVisible: isVisible |
|
13444 }; |
|
13445 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref4) { |
|
13446 var clientIds = _ref4.clientIds; |
|
13447 |
|
13448 var _dispatch = dispatch('core/editor'), |
|
13449 convertBlockToReusable = _dispatch.__experimentalConvertBlockToReusable, |
|
13450 convertBlockToStatic = _dispatch.__experimentalConvertBlockToStatic; |
|
13451 |
|
13452 return { |
|
13453 onConvertToStatic: function onConvertToStatic() { |
|
13454 convertBlockToStatic(clientIds[0]); |
|
13455 }, |
|
13456 onConvertToReusable: function onConvertToReusable() { |
|
13457 convertBlockToReusable(clientIds); |
|
13458 } |
|
13459 }; |
|
13460 })])(ReusableBlockConvertButton)); |
|
13461 |
|
13462 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/reusable-block-delete-button.js |
|
13463 |
|
13464 |
|
13465 /** |
|
13466 * WordPress dependencies |
|
13467 */ |
|
13468 |
|
13469 |
|
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 function ReusableBlockDeleteButton(_ref) { |
|
13475 var isVisible = _ref.isVisible, |
|
13476 isDisabled = _ref.isDisabled, |
|
13477 onDelete = _ref.onDelete; |
|
13478 |
|
13479 if (!isVisible) { |
|
13480 return null; |
|
13481 } |
|
13482 |
|
13483 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSettingsMenuControls"], null, function (_ref2) { |
|
13484 var onClose = _ref2.onClose; |
|
13485 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { |
|
13486 disabled: isDisabled, |
|
13487 onClick: function onClick() { |
|
13488 var hasConfirmed = onDelete(); |
|
13489 |
|
13490 if (hasConfirmed) { |
|
13491 onClose(); |
|
13492 } |
|
13493 } |
|
13494 }, Object(external_this_wp_i18n_["__"])('Remove from Reusable blocks')); |
|
13495 }); |
|
13496 } |
|
13497 /* harmony default export */ var reusable_block_delete_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { |
|
13498 var clientId = _ref3.clientId; |
|
13499 |
|
13500 var _select = select('core/block-editor'), |
|
13501 getBlock = _select.getBlock; |
|
13502 |
|
13503 var _select2 = select('core'), |
|
13504 canUser = _select2.canUser; |
|
13505 |
|
13506 var _select3 = select('core/editor'), |
|
13507 getReusableBlock = _select3.__experimentalGetReusableBlock; |
|
13508 |
|
13509 var block = getBlock(clientId); |
|
13510 var reusableBlock = block && Object(external_this_wp_blocks_["isReusableBlock"])(block) ? getReusableBlock(block.attributes.ref) : null; |
|
13511 return { |
|
13512 isVisible: !!reusableBlock && (reusableBlock.isTemporary || !!canUser('delete', 'blocks', reusableBlock.id)), |
|
13513 isDisabled: reusableBlock && reusableBlock.isTemporary |
|
13514 }; |
|
13515 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref4, _ref5) { |
|
13516 var clientId = _ref4.clientId; |
|
13517 var select = _ref5.select; |
|
13518 |
|
13519 var _dispatch = dispatch('core/editor'), |
|
13520 deleteReusableBlock = _dispatch.__experimentalDeleteReusableBlock; |
|
13521 |
|
13522 var _select4 = select('core/block-editor'), |
|
13523 getBlock = _select4.getBlock; |
|
13524 |
|
13525 return { |
|
13526 onDelete: function onDelete() { |
|
13527 // TODO: Make this a <Confirm /> component or similar |
|
13528 // eslint-disable-next-line no-alert |
|
13529 var hasConfirmed = window.confirm( // eslint-disable-next-line @wordpress/i18n-no-collapsible-whitespace |
|
13530 Object(external_this_wp_i18n_["__"])('Are you sure you want to delete this Reusable Block?\n\n' + 'It will be permanently removed from all posts and pages that use it.')); |
|
13531 |
|
13532 if (hasConfirmed) { |
|
13533 var block = getBlock(clientId); |
|
13534 deleteReusableBlock(block.attributes.ref); |
|
13535 } |
|
13536 |
|
13537 return hasConfirmed; |
|
13538 } |
|
13539 }; |
|
13540 })])(ReusableBlockDeleteButton)); |
|
13541 |
|
13542 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/index.js |
|
13543 |
|
13544 |
|
13545 /** |
|
13546 * WordPress dependencies |
|
13547 */ |
|
13548 |
|
14873 /** |
13549 /** |
14874 * Internal dependencies |
13550 * Internal dependencies |
14875 */ |
13551 */ |
14876 |
13552 |
14877 |
13553 |
14878 |
13554 |
14879 |
13555 |
13556 function ReusableBlocksButtons(_ref) { |
|
13557 var clientIds = _ref.clientIds; |
|
13558 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(reusable_block_convert_button, { |
|
13559 clientIds: clientIds |
|
13560 }), clientIds.length === 1 && Object(external_this_wp_element_["createElement"])(reusable_block_delete_button, { |
|
13561 clientId: clientIds[0] |
|
13562 })); |
|
13563 } |
|
13564 |
|
13565 /* harmony default export */ var reusable_blocks_buttons = (Object(external_this_wp_data_["withSelect"])(function (select) { |
|
13566 var _select = select('core/block-editor'), |
|
13567 getSelectedBlockClientIds = _select.getSelectedBlockClientIds; |
|
13568 |
|
13569 return { |
|
13570 clientIds: getSelectedBlockClientIds() |
|
13571 }; |
|
13572 })(ReusableBlocksButtons)); |
|
13573 |
|
13574 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/convert-to-group-buttons/index.js |
|
13575 |
|
13576 |
|
13577 /** |
|
13578 * WordPress dependencies |
|
13579 */ |
|
13580 |
|
13581 |
|
13582 |
|
13583 |
|
13584 |
|
13585 |
|
13586 function ConvertToGroupButton(_ref) { |
|
13587 var onConvertToGroup = _ref.onConvertToGroup, |
|
13588 onConvertFromGroup = _ref.onConvertFromGroup, |
|
13589 _ref$isGroupable = _ref.isGroupable, |
|
13590 isGroupable = _ref$isGroupable === void 0 ? false : _ref$isGroupable, |
|
13591 _ref$isUngroupable = _ref.isUngroupable, |
|
13592 isUngroupable = _ref$isUngroupable === void 0 ? false : _ref$isUngroupable; |
|
13593 |
|
13594 if (!isGroupable && !isUngroupable) { |
|
13595 return null; |
|
13596 } |
|
13597 |
|
13598 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSettingsMenuControls"], null, function (_ref2) { |
|
13599 var onClose = _ref2.onClose; |
|
13600 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isGroupable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { |
|
13601 onClick: function onClick() { |
|
13602 onConvertToGroup(); |
|
13603 onClose(); |
|
13604 } |
|
13605 }, Object(external_this_wp_i18n_["_x"])('Group', 'verb')), isUngroupable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { |
|
13606 onClick: function onClick() { |
|
13607 onConvertFromGroup(); |
|
13608 onClose(); |
|
13609 } |
|
13610 }, Object(external_this_wp_i18n_["_x"])('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor '))); |
|
13611 }); |
|
13612 } |
|
13613 /* harmony default export */ var convert_to_group_buttons = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
|
13614 var _select = select('core/block-editor'), |
|
13615 getBlockRootClientId = _select.getBlockRootClientId, |
|
13616 getBlocksByClientId = _select.getBlocksByClientId, |
|
13617 canInsertBlockType = _select.canInsertBlockType, |
|
13618 getSelectedBlockClientIds = _select.getSelectedBlockClientIds; |
|
13619 |
|
13620 var _select2 = select('core/blocks'), |
|
13621 getGroupingBlockName = _select2.getGroupingBlockName; |
|
13622 |
|
13623 var clientIds = getSelectedBlockClientIds(); |
|
13624 var groupingBlockName = getGroupingBlockName(); |
|
13625 var rootClientId = clientIds && clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined; |
|
13626 var groupingBlockAvailable = canInsertBlockType(groupingBlockName, rootClientId); |
|
13627 var blocksSelection = getBlocksByClientId(clientIds); |
|
13628 var isSingleGroupingBlock = blocksSelection.length === 1 && blocksSelection[0] && blocksSelection[0].name === groupingBlockName; // Do we have |
|
13629 // 1. Grouping block available to be inserted? |
|
13630 // 2. One or more blocks selected |
|
13631 // (we allow single Blocks to become groups unless |
|
13632 // they are a soltiary group block themselves) |
|
13633 |
|
13634 var isGroupable = groupingBlockAvailable && blocksSelection.length && !isSingleGroupingBlock; // Do we have a single Group Block selected and does that group have inner blocks? |
|
13635 |
|
13636 var isUngroupable = isSingleGroupingBlock && !!blocksSelection[0].innerBlocks.length; |
|
13637 return { |
|
13638 clientIds: clientIds, |
|
13639 isGroupable: isGroupable, |
|
13640 isUngroupable: isUngroupable, |
|
13641 blocksSelection: blocksSelection, |
|
13642 groupingBlockName: groupingBlockName |
|
13643 }; |
|
13644 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { |
|
13645 var clientIds = _ref3.clientIds, |
|
13646 _ref3$blocksSelection = _ref3.blocksSelection, |
|
13647 blocksSelection = _ref3$blocksSelection === void 0 ? [] : _ref3$blocksSelection, |
|
13648 groupingBlockName = _ref3.groupingBlockName; |
|
13649 |
|
13650 var _dispatch = dispatch('core/block-editor'), |
|
13651 replaceBlocks = _dispatch.replaceBlocks; |
|
13652 |
|
13653 return { |
|
13654 onConvertToGroup: function onConvertToGroup() { |
|
13655 // Activate the `transform` on the Grouping Block which does the conversion |
|
13656 var newBlocks = Object(external_this_wp_blocks_["switchToBlockType"])(blocksSelection, groupingBlockName); |
|
13657 |
|
13658 if (newBlocks) { |
|
13659 replaceBlocks(clientIds, newBlocks); |
|
13660 } |
|
13661 }, |
|
13662 onConvertFromGroup: function onConvertFromGroup() { |
|
13663 var innerBlocks = blocksSelection[0].innerBlocks; |
|
13664 |
|
13665 if (!innerBlocks.length) { |
|
13666 return; |
|
13667 } |
|
13668 |
|
13669 replaceBlocks(clientIds, innerBlocks); |
|
13670 } |
|
13671 }; |
|
13672 })])(ConvertToGroupButton)); |
|
13673 |
|
14880 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js |
13674 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js |
14881 |
13675 |
14882 |
13676 |
14883 |
13677 |
14884 |
13678 |
14885 |
13679 |
14886 |
13680 |
14887 |
13681 |
14888 |
13682 |
13683 |
|
13684 |
|
13685 function provider_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
13686 |
|
13687 function provider_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { provider_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { provider_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
13688 |
|
13689 function provider_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (provider_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
13690 |
|
13691 function provider_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
13692 |
|
14889 /** |
13693 /** |
14890 * External dependencies |
13694 * External dependencies |
14891 */ |
13695 */ |
14892 |
13696 |
14893 |
13697 |
14898 |
13702 |
14899 |
13703 |
14900 |
13704 |
14901 |
13705 |
14902 |
13706 |
13707 |
|
13708 |
|
13709 |
|
13710 |
|
14903 /** |
13711 /** |
14904 * Internal dependencies |
13712 * Internal dependencies |
14905 */ |
13713 */ |
14906 |
13714 |
14907 |
13715 |
14908 |
13716 |
14909 |
13717 |
14910 var provider_EditorProvider = |
13718 |
14911 /*#__PURE__*/ |
13719 /** |
14912 function (_Component) { |
13720 * Fetches link suggestions from the API. This function is an exact copy of a function found at: |
13721 * |
|
13722 * wordpress/editor/src/components/provider/index.js |
|
13723 * |
|
13724 * It seems like there is no suitable package to import this from. Ideally it would be either part of core-data. |
|
13725 * Until we refactor it, just copying the code is the simplest solution. |
|
13726 * |
|
13727 * @param {Object} search |
|
13728 * @param {number} perPage |
|
13729 * @return {Promise<Object[]>} List of suggestions |
|
13730 */ |
|
13731 |
|
13732 var fetchLinkSuggestions = /*#__PURE__*/function () { |
|
13733 var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee(search) { |
|
13734 var _ref2, |
|
13735 _ref2$perPage, |
|
13736 perPage, |
|
13737 posts, |
|
13738 _args = arguments; |
|
13739 |
|
13740 return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context) { |
|
13741 while (1) { |
|
13742 switch (_context.prev = _context.next) { |
|
13743 case 0: |
|
13744 _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref2$perPage = _ref2.perPage, perPage = _ref2$perPage === void 0 ? 20 : _ref2$perPage; |
|
13745 _context.next = 3; |
|
13746 return external_this_wp_apiFetch_default()({ |
|
13747 path: Object(external_this_wp_url_["addQueryArgs"])('/wp/v2/search', { |
|
13748 search: search, |
|
13749 per_page: perPage, |
|
13750 type: 'post' |
|
13751 }) |
|
13752 }); |
|
13753 |
|
13754 case 3: |
|
13755 posts = _context.sent; |
|
13756 return _context.abrupt("return", Object(external_this_lodash_["map"])(posts, function (post) { |
|
13757 return { |
|
13758 id: post.id, |
|
13759 url: post.url, |
|
13760 title: Object(external_this_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_this_wp_i18n_["__"])('(no title)'), |
|
13761 type: post.subtype || post.type |
|
13762 }; |
|
13763 })); |
|
13764 |
|
13765 case 5: |
|
13766 case "end": |
|
13767 return _context.stop(); |
|
13768 } |
|
13769 } |
|
13770 }, _callee); |
|
13771 })); |
|
13772 |
|
13773 return function fetchLinkSuggestions(_x) { |
|
13774 return _ref.apply(this, arguments); |
|
13775 }; |
|
13776 }(); |
|
13777 |
|
13778 var provider_EditorProvider = /*#__PURE__*/function (_Component) { |
|
14913 Object(inherits["a" /* default */])(EditorProvider, _Component); |
13779 Object(inherits["a" /* default */])(EditorProvider, _Component); |
13780 |
|
13781 var _super = provider_createSuper(EditorProvider); |
|
14914 |
13782 |
14915 function EditorProvider(props) { |
13783 function EditorProvider(props) { |
14916 var _this; |
13784 var _this; |
14917 |
13785 |
14918 Object(classCallCheck["a" /* default */])(this, EditorProvider); |
13786 Object(classCallCheck["a" /* default */])(this, EditorProvider); |
14919 |
13787 |
14920 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(EditorProvider).apply(this, arguments)); |
13788 _this = _super.apply(this, arguments); |
14921 _this.getBlockEditorSettings = memize_default()(_this.getBlockEditorSettings, { |
13789 _this.getBlockEditorSettings = memize_default()(_this.getBlockEditorSettings, { |
13790 maxSize: 1 |
|
13791 }); |
|
13792 _this.getDefaultBlockContext = memize_default()(_this.getDefaultBlockContext, { |
|
14922 maxSize: 1 |
13793 maxSize: 1 |
14923 }); // Assume that we don't need to initialize in the case of an error recovery. |
13794 }); // Assume that we don't need to initialize in the case of an error recovery. |
14924 |
13795 |
14925 if (props.recovery) { |
13796 if (props.recovery) { |
14926 return Object(possibleConstructorReturn["a" /* default */])(_this); |
13797 return Object(possibleConstructorReturn["a" /* default */])(_this); |
14942 return _this; |
13813 return _this; |
14943 } |
13814 } |
14944 |
13815 |
14945 Object(createClass["a" /* default */])(EditorProvider, [{ |
13816 Object(createClass["a" /* default */])(EditorProvider, [{ |
14946 key: "getBlockEditorSettings", |
13817 key: "getBlockEditorSettings", |
14947 value: function getBlockEditorSettings(settings, meta, onMetaChange, reusableBlocks) { |
13818 value: function getBlockEditorSettings(settings, reusableBlocks, __experimentalFetchReusableBlocks, hasUploadPermissions, canUserUseUnfilteredHTML, undo, shouldInsertAtTheTop) { |
14948 return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["pick"])(settings, ['alignWide', 'allowedBlockTypes', 'availableLegacyWidgets', 'bodyPlaceholder', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'focusMode', 'fontSizes', 'hasFixedToolbar', 'hasPermissionsToManageWidgets', 'imageSizes', 'isRTL', 'maxWidth', 'styles', 'template', 'templateLock', 'titlePlaceholder']), { |
13819 return provider_objectSpread({}, Object(external_this_lodash_["pick"])(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatterns', '__experimentalBlockPatternCategories', '__experimentalEnableCustomSpacing', '__experimentalEnableLegacyWidgetBlock', '__experimentalEnableLinkColor', '__experimentalEnableFullSiteEditing', '__experimentalEnableFullSiteEditingDemo', '__experimentalFeatures', '__experimentalGlobalStylesUserEntityId', '__experimentalGlobalStylesBase', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'availableLegacyWidgets', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomUnits', 'enableCustomLineHeight', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasPermissionsToManageWidgets', 'imageEditing', 'imageSizes', 'imageDimensions', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder']), { |
14949 __experimentalMetaSource: { |
13820 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, |
14950 value: meta, |
|
14951 onChange: onMetaChange |
|
14952 }, |
|
14953 __experimentalReusableBlocks: reusableBlocks, |
13821 __experimentalReusableBlocks: reusableBlocks, |
14954 __experimentalMediaUpload: media_upload |
13822 __experimentalFetchReusableBlocks: __experimentalFetchReusableBlocks, |
13823 __experimentalFetchLinkSuggestions: fetchLinkSuggestions, |
|
13824 __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML, |
|
13825 __experimentalUndo: undo, |
|
13826 __experimentalShouldInsertAtTheTop: shouldInsertAtTheTop |
|
14955 }); |
13827 }); |
13828 } |
|
13829 }, { |
|
13830 key: "getDefaultBlockContext", |
|
13831 value: function getDefaultBlockContext(postId, postType) { |
|
13832 return { |
|
13833 postId: postId, |
|
13834 postType: postType |
|
13835 }; |
|
14956 } |
13836 } |
14957 }, { |
13837 }, { |
14958 key: "componentDidMount", |
13838 key: "componentDidMount", |
14959 value: function componentDidMount() { |
13839 value: function componentDidMount() { |
14960 this.props.updateEditorSettings(this.props.settings); |
13840 this.props.updateEditorSettings(this.props.settings); |
14961 |
|
14962 if (!this.props.settings.styles) { |
|
14963 return; |
|
14964 } |
|
14965 |
|
14966 var updatedStyles = editor_styles(this.props.settings.styles, '.editor-styles-wrapper'); |
|
14967 Object(external_lodash_["map"])(updatedStyles, function (updatedCSS) { |
|
14968 if (updatedCSS) { |
|
14969 var node = document.createElement('style'); |
|
14970 node.innerHTML = updatedCSS; |
|
14971 document.body.appendChild(node); |
|
14972 } |
|
14973 }); |
|
14974 } |
13841 } |
14975 }, { |
13842 }, { |
14976 key: "componentDidUpdate", |
13843 key: "componentDidUpdate", |
14977 value: function componentDidUpdate(prevProps) { |
13844 value: function componentDidUpdate(prevProps) { |
14978 if (this.props.settings !== prevProps.settings) { |
13845 if (this.props.settings !== prevProps.settings) { |
14979 this.props.updateEditorSettings(this.props.settings); |
13846 this.props.updateEditorSettings(this.props.settings); |
14980 } |
13847 } |
14981 } |
13848 } |
14982 }, { |
13849 }, { |
13850 key: "componentWillUnmount", |
|
13851 value: function componentWillUnmount() { |
|
13852 this.props.tearDownEditor(); |
|
13853 } |
|
13854 }, { |
|
14983 key: "render", |
13855 key: "render", |
14984 value: function render() { |
13856 value: function render() { |
14985 var _this$props = this.props, |
13857 var _this$props = this.props, |
13858 canUserUseUnfilteredHTML = _this$props.canUserUseUnfilteredHTML, |
|
14986 children = _this$props.children, |
13859 children = _this$props.children, |
13860 post = _this$props.post, |
|
14987 blocks = _this$props.blocks, |
13861 blocks = _this$props.blocks, |
14988 resetEditorBlocks = _this$props.resetEditorBlocks, |
13862 resetEditorBlocks = _this$props.resetEditorBlocks, |
13863 selectionStart = _this$props.selectionStart, |
|
13864 selectionEnd = _this$props.selectionEnd, |
|
14989 isReady = _this$props.isReady, |
13865 isReady = _this$props.isReady, |
14990 settings = _this$props.settings, |
13866 settings = _this$props.settings, |
14991 meta = _this$props.meta, |
|
14992 onMetaChange = _this$props.onMetaChange, |
|
14993 reusableBlocks = _this$props.reusableBlocks, |
13867 reusableBlocks = _this$props.reusableBlocks, |
14994 resetEditorBlocksWithoutUndoLevel = _this$props.resetEditorBlocksWithoutUndoLevel; |
13868 resetEditorBlocksWithoutUndoLevel = _this$props.resetEditorBlocksWithoutUndoLevel, |
13869 hasUploadPermissions = _this$props.hasUploadPermissions, |
|
13870 isPostTitleSelected = _this$props.isPostTitleSelected, |
|
13871 __experimentalFetchReusableBlocks = _this$props.__experimentalFetchReusableBlocks, |
|
13872 undo = _this$props.undo; |
|
14995 |
13873 |
14996 if (!isReady) { |
13874 if (!isReady) { |
14997 return null; |
13875 return null; |
14998 } |
13876 } |
14999 |
13877 |
15000 var editorSettings = this.getBlockEditorSettings(settings, meta, onMetaChange, reusableBlocks); |
13878 var editorSettings = this.getBlockEditorSettings(settings, reusableBlocks, __experimentalFetchReusableBlocks, hasUploadPermissions, canUserUseUnfilteredHTML, undo, isPostTitleSelected); |
15001 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorProvider"], { |
13879 var defaultBlockContext = this.getDefaultBlockContext(post.id, post.type); |
13880 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__unstableEditorStyles"], { |
|
13881 styles: settings.styles |
|
13882 }), Object(external_this_wp_element_["createElement"])(external_this_wp_coreData_["EntityProvider"], { |
|
13883 kind: "root", |
|
13884 type: "site" |
|
13885 }, Object(external_this_wp_element_["createElement"])(external_this_wp_coreData_["EntityProvider"], { |
|
13886 kind: "postType", |
|
13887 type: post.type, |
|
13888 id: post.id |
|
13889 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockContextProvider"], { |
|
13890 value: defaultBlockContext |
|
13891 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorProvider"], { |
|
15002 value: blocks, |
13892 value: blocks, |
15003 onInput: resetEditorBlocksWithoutUndoLevel, |
13893 onInput: resetEditorBlocksWithoutUndoLevel, |
15004 onChange: resetEditorBlocks, |
13894 onChange: resetEditorBlocks, |
15005 settings: editorSettings |
13895 selectionStart: selectionStart, |
15006 }, children); |
13896 selectionEnd: selectionEnd, |
13897 settings: editorSettings, |
|
13898 useSubRegistry: false |
|
13899 }, children, Object(external_this_wp_element_["createElement"])(reusable_blocks_buttons, null), Object(external_this_wp_element_["createElement"])(convert_to_group_buttons, null)))))); |
|
15007 } |
13900 } |
15008 }]); |
13901 }]); |
15009 |
13902 |
15010 return EditorProvider; |
13903 return EditorProvider; |
15011 }(external_this_wp_element_["Component"]); |
13904 }(external_this_wp_element_["Component"]); |
15012 |
13905 |
15013 /* harmony default export */ var provider = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { |
13906 /* harmony default export */ var provider = (Object(external_this_wp_compose_["compose"])([with_registry_provider, Object(external_this_wp_data_["withSelect"])(function (select) { |
15014 var _select = select('core/editor'), |
13907 var _select = select('core/editor'), |
13908 canUserUseUnfilteredHTML = _select.canUserUseUnfilteredHTML, |
|
15015 isEditorReady = _select.__unstableIsEditorReady, |
13909 isEditorReady = _select.__unstableIsEditorReady, |
15016 getEditorBlocks = _select.getEditorBlocks, |
13910 getEditorBlocks = _select.getEditorBlocks, |
15017 getEditedPostAttribute = _select.getEditedPostAttribute, |
13911 getEditorSelectionStart = _select.getEditorSelectionStart, |
15018 __experimentalGetReusableBlocks = _select.__experimentalGetReusableBlocks; |
13912 getEditorSelectionEnd = _select.getEditorSelectionEnd, |
13913 __experimentalGetReusableBlocks = _select.__experimentalGetReusableBlocks, |
|
13914 isPostTitleSelected = _select.isPostTitleSelected; |
|
13915 |
|
13916 var _select2 = select('core'), |
|
13917 canUser = _select2.canUser; |
|
15019 |
13918 |
15020 return { |
13919 return { |
13920 canUserUseUnfilteredHTML: canUserUseUnfilteredHTML(), |
|
15021 isReady: isEditorReady(), |
13921 isReady: isEditorReady(), |
15022 blocks: getEditorBlocks(), |
13922 blocks: getEditorBlocks(), |
15023 meta: getEditedPostAttribute('meta'), |
13923 selectionStart: getEditorSelectionStart(), |
15024 reusableBlocks: __experimentalGetReusableBlocks() |
13924 selectionEnd: getEditorSelectionEnd(), |
13925 reusableBlocks: __experimentalGetReusableBlocks(), |
|
13926 hasUploadPermissions: Object(external_this_lodash_["defaultTo"])(canUser('create', 'media'), true), |
|
13927 // This selector is only defined on mobile. |
|
13928 isPostTitleSelected: isPostTitleSelected && isPostTitleSelected() |
|
15025 }; |
13929 }; |
15026 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
13930 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { |
15027 var _dispatch = dispatch('core/editor'), |
13931 var _dispatch = dispatch('core/editor'), |
15028 setupEditor = _dispatch.setupEditor, |
13932 setupEditor = _dispatch.setupEditor, |
15029 updatePostLock = _dispatch.updatePostLock, |
13933 updatePostLock = _dispatch.updatePostLock, |
15030 resetEditorBlocks = _dispatch.resetEditorBlocks, |
13934 resetEditorBlocks = _dispatch.resetEditorBlocks, |
15031 editPost = _dispatch.editPost, |
13935 updateEditorSettings = _dispatch.updateEditorSettings, |
15032 updateEditorSettings = _dispatch.updateEditorSettings; |
13936 __experimentalFetchReusableBlocks = _dispatch.__experimentalFetchReusableBlocks, |
13937 __experimentalTearDownEditor = _dispatch.__experimentalTearDownEditor, |
|
13938 undo = _dispatch.undo; |
|
15033 |
13939 |
15034 var _dispatch2 = dispatch('core/notices'), |
13940 var _dispatch2 = dispatch('core/notices'), |
15035 createWarningNotice = _dispatch2.createWarningNotice; |
13941 createWarningNotice = _dispatch2.createWarningNotice; |
15036 |
13942 |
15037 return { |
13943 return { |
15038 setupEditor: setupEditor, |
13944 setupEditor: setupEditor, |
15039 updatePostLock: updatePostLock, |
13945 updatePostLock: updatePostLock, |
15040 createWarningNotice: createWarningNotice, |
13946 createWarningNotice: createWarningNotice, |
15041 resetEditorBlocks: resetEditorBlocks, |
13947 resetEditorBlocks: resetEditorBlocks, |
15042 updateEditorSettings: updateEditorSettings, |
13948 updateEditorSettings: updateEditorSettings, |
15043 resetEditorBlocksWithoutUndoLevel: function resetEditorBlocksWithoutUndoLevel(blocks) { |
13949 resetEditorBlocksWithoutUndoLevel: function resetEditorBlocksWithoutUndoLevel(blocks, options) { |
15044 resetEditorBlocks(blocks, { |
13950 resetEditorBlocks(blocks, provider_objectSpread({}, options, { |
15045 __unstableShouldCreateUndoLevel: false |
13951 __unstableShouldCreateUndoLevel: false |
15046 }); |
13952 })); |
15047 }, |
13953 }, |
15048 onMetaChange: function onMetaChange(meta) { |
13954 tearDownEditor: __experimentalTearDownEditor, |
15049 editPost({ |
13955 __experimentalFetchReusableBlocks: __experimentalFetchReusableBlocks, |
15050 meta: meta |
13956 undo: undo |
15051 }); |
|
15052 } |
|
15053 }; |
13957 }; |
15054 })])(provider_EditorProvider)); |
13958 })])(provider_EditorProvider)); |
15055 |
13959 |
13960 // EXTERNAL MODULE: external {"this":["wp","serverSideRender"]} |
|
13961 var external_this_wp_serverSideRender_ = __webpack_require__(83); |
|
13962 var external_this_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_serverSideRender_); |
|
13963 |
|
15056 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js |
13964 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js |
13965 |
|
13966 |
|
15057 // Block Creation Components |
13967 // Block Creation Components |
15058 |
13968 |
15059 /** |
13969 /** |
15060 * WordPress dependencies |
13970 * WordPress dependencies |
15061 */ |
13971 */ |
15062 |
13972 |
15063 |
13973 |
13974 |
|
13975 |
|
13976 |
|
13977 function deprecateComponent(name, Wrapped) { |
|
13978 var staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; |
|
13979 var Component = Object(external_this_wp_element_["forwardRef"])(function (props, ref) { |
|
13980 external_this_wp_deprecated_default()('wp.editor.' + name, { |
|
13981 alternative: 'wp.blockEditor.' + name |
|
13982 }); |
|
13983 return Object(external_this_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({ |
|
13984 ref: ref |
|
13985 }, props)); |
|
13986 }); |
|
13987 staticsToHoist.forEach(function (staticName) { |
|
13988 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); |
|
13989 }); |
|
13990 return Component; |
|
13991 } |
|
13992 |
|
13993 function deprecateFunction(name, func) { |
|
13994 return function () { |
|
13995 external_this_wp_deprecated_default()('wp.editor.' + name, { |
|
13996 alternative: 'wp.blockEditor.' + name |
|
13997 }); |
|
13998 return func.apply(void 0, arguments); |
|
13999 }; |
|
14000 } |
|
14001 |
|
14002 var RichText = deprecateComponent('RichText', external_this_wp_blockEditor_["RichText"], ['Content']); |
|
14003 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_this_wp_blockEditor_["RichText"].isEmpty); |
|
14004 |
|
14005 var Autocomplete = deprecateComponent('Autocomplete', external_this_wp_blockEditor_["Autocomplete"]); |
|
14006 var AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_this_wp_blockEditor_["AlignmentToolbar"]); |
|
14007 var BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_this_wp_blockEditor_["BlockAlignmentToolbar"]); |
|
14008 var BlockControls = deprecateComponent('BlockControls', external_this_wp_blockEditor_["BlockControls"], ['Slot']); |
|
14009 var deprecated_BlockEdit = deprecateComponent('BlockEdit', external_this_wp_blockEditor_["BlockEdit"]); |
|
14010 var BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"]); |
|
14011 var BlockFormatControls = deprecateComponent('BlockFormatControls', external_this_wp_blockEditor_["BlockFormatControls"], ['Slot']); |
|
14012 var BlockIcon = deprecateComponent('BlockIcon', external_this_wp_blockEditor_["BlockIcon"]); |
|
14013 var BlockInspector = deprecateComponent('BlockInspector', external_this_wp_blockEditor_["BlockInspector"]); |
|
14014 var BlockList = deprecateComponent('BlockList', external_this_wp_blockEditor_["BlockList"]); |
|
14015 var BlockMover = deprecateComponent('BlockMover', external_this_wp_blockEditor_["BlockMover"]); |
|
14016 var BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_this_wp_blockEditor_["BlockNavigationDropdown"]); |
|
14017 var BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_this_wp_blockEditor_["BlockSelectionClearer"]); |
|
14018 var BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_this_wp_blockEditor_["BlockSettingsMenu"]); |
|
14019 var BlockTitle = deprecateComponent('BlockTitle', external_this_wp_blockEditor_["BlockTitle"]); |
|
14020 var BlockToolbar = deprecateComponent('BlockToolbar', external_this_wp_blockEditor_["BlockToolbar"]); |
|
14021 var ColorPalette = deprecateComponent('ColorPalette', external_this_wp_blockEditor_["ColorPalette"]); |
|
14022 var ContrastChecker = deprecateComponent('ContrastChecker', external_this_wp_blockEditor_["ContrastChecker"]); |
|
14023 var CopyHandler = deprecateComponent('CopyHandler', external_this_wp_blockEditor_["CopyHandler"]); |
|
14024 var DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_this_wp_blockEditor_["DefaultBlockAppender"]); |
|
14025 var FontSizePicker = deprecateComponent('FontSizePicker', external_this_wp_blockEditor_["FontSizePicker"]); |
|
14026 var Inserter = deprecateComponent('Inserter', external_this_wp_blockEditor_["Inserter"]); |
|
14027 var InnerBlocks = deprecateComponent('InnerBlocks', external_this_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); |
|
14028 var InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_this_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']); |
|
14029 var InspectorControls = deprecateComponent('InspectorControls', external_this_wp_blockEditor_["InspectorControls"], ['Slot']); |
|
14030 var PanelColorSettings = deprecateComponent('PanelColorSettings', external_this_wp_blockEditor_["PanelColorSettings"]); |
|
14031 var PlainText = deprecateComponent('PlainText', external_this_wp_blockEditor_["PlainText"]); |
|
14032 var RichTextShortcut = deprecateComponent('RichTextShortcut', external_this_wp_blockEditor_["RichTextShortcut"]); |
|
14033 var RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_this_wp_blockEditor_["RichTextToolbarButton"]); |
|
14034 var __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_this_wp_blockEditor_["__unstableRichTextInputEvent"]); |
|
14035 var MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_this_wp_blockEditor_["MediaPlaceholder"]); |
|
14036 var MediaUpload = deprecateComponent('MediaUpload', external_this_wp_blockEditor_["MediaUpload"]); |
|
14037 var MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_this_wp_blockEditor_["MediaUploadCheck"]); |
|
14038 var MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_this_wp_blockEditor_["MultiSelectScrollIntoView"]); |
|
14039 var NavigableToolbar = deprecateComponent('NavigableToolbar', external_this_wp_blockEditor_["NavigableToolbar"]); |
|
14040 var ObserveTyping = deprecateComponent('ObserveTyping', external_this_wp_blockEditor_["ObserveTyping"]); |
|
14041 var PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_this_wp_blockEditor_["PreserveScrollInReorder"]); |
|
14042 var SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_this_wp_blockEditor_["SkipToSelectedBlock"]); |
|
14043 var URLInput = deprecateComponent('URLInput', external_this_wp_blockEditor_["URLInput"]); |
|
14044 var URLInputButton = deprecateComponent('URLInputButton', external_this_wp_blockEditor_["URLInputButton"]); |
|
14045 var URLPopover = deprecateComponent('URLPopover', external_this_wp_blockEditor_["URLPopover"]); |
|
14046 var Warning = deprecateComponent('Warning', external_this_wp_blockEditor_["Warning"]); |
|
14047 var WritingFlow = deprecateComponent('WritingFlow', external_this_wp_blockEditor_["WritingFlow"]); |
|
14048 var createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_this_wp_blockEditor_["createCustomColorsHOC"]); |
|
14049 var getColorClassName = deprecateFunction('getColorClassName', external_this_wp_blockEditor_["getColorClassName"]); |
|
14050 var getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_this_wp_blockEditor_["getColorObjectByAttributeValues"]); |
|
14051 var getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_this_wp_blockEditor_["getColorObjectByColorValue"]); |
|
14052 var getFontSize = deprecateFunction('getFontSize', external_this_wp_blockEditor_["getFontSize"]); |
|
14053 var getFontSizeClass = deprecateFunction('getFontSizeClass', external_this_wp_blockEditor_["getFontSizeClass"]); |
|
14054 var withColorContext = deprecateFunction('withColorContext', external_this_wp_blockEditor_["withColorContext"]); |
|
14055 var withColors = deprecateFunction('withColors', external_this_wp_blockEditor_["withColors"]); |
|
14056 var withFontSizes = deprecateFunction('withFontSizes', external_this_wp_blockEditor_["withFontSizes"]); |
|
15064 |
14057 |
15065 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js |
14058 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js |
15066 // Block Creation Components |
14059 // Block Creation Components |
15067 |
|
15068 // Post Related Components |
14060 // Post Related Components |
15069 |
14061 |
15070 |
14062 |
15071 |
14063 |
15072 |
14064 |
15116 |
14108 |
15117 |
14109 |
15118 |
14110 |
15119 |
14111 |
15120 |
14112 |
14113 |
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
15121 // State Related Components |
14118 // State Related Components |
15122 |
14119 |
15123 |
14120 |
15124 |
14121 |
15125 |
14122 |
15126 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js |
14123 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js |
15127 /** |
14124 /** |
15128 * External dependencies |
14125 * Internal dependencies |
15129 */ |
14126 */ |
15130 |
14127 |
14128 |
|
14129 |
|
14130 |
|
14131 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js |
|
15131 /** |
14132 /** |
15132 * WordPress dependencies |
14133 * WordPress dependencies |
15133 */ |
14134 */ |
15134 |
14135 |
15135 |
14136 |
15136 |
14137 |
15137 |
14138 |
14139 |
|
14140 |
|
14141 |
|
15138 /** |
14142 /** |
15139 * Internal dependencies |
14143 * Internal dependencies |
15140 */ |
14144 */ |
15141 |
14145 |
15142 |
14146 |
15143 var defaultAutocompleters = [autocompleters_user]; |
14147 |
15144 var default_autocompleters_fetchReusableBlocks = Object(external_lodash_["once"])(function () { |
14148 |
15145 return Object(external_this_wp_data_["dispatch"])('core/editor').__experimentalFetchReusableBlocks(); |
14149 |
15146 }); |
14150 |
15147 |
14151 /* |
15148 function setDefaultCompleters(completers, blockName) { |
14152 * Backward compatibility |
15149 if (!completers) { |
14153 */ |
15150 // Provide copies so filters may directly modify them. |
14154 |
15151 completers = defaultAutocompleters.map(external_lodash_["clone"]); // Add blocks autocompleter for Paragraph block |
14155 |
15152 |
14156 |
15153 if (blockName === Object(external_this_wp_blocks_["getDefaultBlockName"])()) { |
14157 |
15154 completers.push(Object(external_lodash_["clone"])(autocompleters_block)); |
14158 /***/ }), |
15155 /* |
14159 |
15156 * NOTE: This is a hack to help ensure reusable blocks are loaded |
14160 /***/ 45: |
15157 * so they may be included in the block completer. It can be removed |
14161 /***/ (function(module, exports) { |
15158 * once we have a way for completers to Promise options while |
14162 |
15159 * store-based data dependencies are being resolved. |
14163 (function() { module.exports = this["wp"]["apiFetch"]; }()); |
15160 */ |
14164 |
15161 |
14165 /***/ }), |
15162 default_autocompleters_fetchReusableBlocks(); |
14166 |
15163 } |
14167 /***/ 5: |
14168 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
14169 |
|
14170 "use strict"; |
|
14171 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
14172 function _defineProperty(obj, key, value) { |
|
14173 if (key in obj) { |
|
14174 Object.defineProperty(obj, key, { |
|
14175 value: value, |
|
14176 enumerable: true, |
|
14177 configurable: true, |
|
14178 writable: true |
|
14179 }); |
|
14180 } else { |
|
14181 obj[key] = value; |
|
15164 } |
14182 } |
15165 |
14183 |
15166 return completers; |
14184 return obj; |
15167 } |
14185 } |
15168 |
|
15169 Object(external_this_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); |
|
15170 |
|
15171 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js |
|
15172 /** |
|
15173 * Internal dependencies |
|
15174 */ |
|
15175 |
|
15176 |
|
15177 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js |
|
15178 /* concated harmony reexport ServerSideRender */__webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return server_side_render; }); |
|
15179 /* concated harmony reexport AutosaveMonitor */__webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return autosave_monitor; }); |
|
15180 /* concated harmony reexport DocumentOutline */__webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return document_outline; }); |
|
15181 /* concated harmony reexport DocumentOutlineCheck */__webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return check; }); |
|
15182 /* concated harmony reexport VisualEditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return visual_editor_shortcuts; }); |
|
15183 /* concated harmony reexport EditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "EditorGlobalKeyboardShortcuts", function() { return EditorGlobalKeyboardShortcuts; }); |
|
15184 /* concated harmony reexport TextEditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return TextEditorGlobalKeyboardShortcuts; }); |
|
15185 /* concated harmony reexport EditorHistoryRedo */__webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return editor_history_redo; }); |
|
15186 /* concated harmony reexport EditorHistoryUndo */__webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return editor_history_undo; }); |
|
15187 /* concated harmony reexport EditorNotices */__webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return editor_notices; }); |
|
15188 /* concated harmony reexport ErrorBoundary */__webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return error_boundary; }); |
|
15189 /* concated harmony reexport PageAttributesCheck */__webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return page_attributes_check; }); |
|
15190 /* concated harmony reexport PageAttributesOrder */__webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return page_attributes_order; }); |
|
15191 /* concated harmony reexport PageAttributesParent */__webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return page_attributes_parent; }); |
|
15192 /* concated harmony reexport PageTemplate */__webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return page_attributes_template; }); |
|
15193 /* concated harmony reexport PostAuthor */__webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return post_author; }); |
|
15194 /* concated harmony reexport PostAuthorCheck */__webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return post_author_check; }); |
|
15195 /* concated harmony reexport PostComments */__webpack_require__.d(__webpack_exports__, "PostComments", function() { return post_comments; }); |
|
15196 /* concated harmony reexport PostExcerpt */__webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return post_excerpt; }); |
|
15197 /* concated harmony reexport PostExcerptCheck */__webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return post_excerpt_check; }); |
|
15198 /* concated harmony reexport PostFeaturedImage */__webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return post_featured_image; }); |
|
15199 /* concated harmony reexport PostFeaturedImageCheck */__webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return post_featured_image_check; }); |
|
15200 /* concated harmony reexport PostFormat */__webpack_require__.d(__webpack_exports__, "PostFormat", function() { return post_format; }); |
|
15201 /* concated harmony reexport PostFormatCheck */__webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return post_format_check; }); |
|
15202 /* concated harmony reexport PostLastRevision */__webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return post_last_revision; }); |
|
15203 /* concated harmony reexport PostLastRevisionCheck */__webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return post_last_revision_check; }); |
|
15204 /* concated harmony reexport PostLockedModal */__webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return post_locked_modal; }); |
|
15205 /* concated harmony reexport PostPendingStatus */__webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return post_pending_status; }); |
|
15206 /* concated harmony reexport PostPendingStatusCheck */__webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return post_pending_status_check; }); |
|
15207 /* concated harmony reexport PostPingbacks */__webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return post_pingbacks; }); |
|
15208 /* concated harmony reexport PostPreviewButton */__webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return post_preview_button; }); |
|
15209 /* concated harmony reexport PostPublishButton */__webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return post_publish_button; }); |
|
15210 /* concated harmony reexport PostPublishButtonLabel */__webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return post_publish_button_label; }); |
|
15211 /* concated harmony reexport PostPublishPanel */__webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return post_publish_panel; }); |
|
15212 /* concated harmony reexport PostSavedState */__webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return post_saved_state; }); |
|
15213 /* concated harmony reexport PostSchedule */__webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return post_schedule; }); |
|
15214 /* concated harmony reexport PostScheduleCheck */__webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return post_schedule_check; }); |
|
15215 /* concated harmony reexport PostScheduleLabel */__webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return post_schedule_label; }); |
|
15216 /* concated harmony reexport PostSticky */__webpack_require__.d(__webpack_exports__, "PostSticky", function() { return post_sticky; }); |
|
15217 /* concated harmony reexport PostStickyCheck */__webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return post_sticky_check; }); |
|
15218 /* concated harmony reexport PostSwitchToDraftButton */__webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return post_switch_to_draft_button; }); |
|
15219 /* concated harmony reexport PostTaxonomies */__webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return post_taxonomies; }); |
|
15220 /* concated harmony reexport PostTaxonomiesCheck */__webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return post_taxonomies_check; }); |
|
15221 /* concated harmony reexport PostTextEditor */__webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return post_text_editor; }); |
|
15222 /* concated harmony reexport PostTitle */__webpack_require__.d(__webpack_exports__, "PostTitle", function() { return post_title; }); |
|
15223 /* concated harmony reexport PostTrash */__webpack_require__.d(__webpack_exports__, "PostTrash", function() { return post_trash; }); |
|
15224 /* concated harmony reexport PostTrashCheck */__webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return post_trash_check; }); |
|
15225 /* concated harmony reexport PostTypeSupportCheck */__webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return post_type_support_check; }); |
|
15226 /* concated harmony reexport PostVisibility */__webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return post_visibility; }); |
|
15227 /* concated harmony reexport PostVisibilityLabel */__webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return post_visibility_label; }); |
|
15228 /* concated harmony reexport PostVisibilityCheck */__webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return post_visibility_check; }); |
|
15229 /* concated harmony reexport TableOfContents */__webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return table_of_contents; }); |
|
15230 /* concated harmony reexport UnsavedChangesWarning */__webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return unsaved_changes_warning; }); |
|
15231 /* concated harmony reexport WordCount */__webpack_require__.d(__webpack_exports__, "WordCount", function() { return word_count; }); |
|
15232 /* concated harmony reexport EditorProvider */__webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return provider; }); |
|
15233 /* concated harmony reexport blockAutocompleter */__webpack_require__.d(__webpack_exports__, "blockAutocompleter", function() { return autocompleters_block; }); |
|
15234 /* concated harmony reexport userAutocompleter */__webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return autocompleters_user; }); |
|
15235 /* concated harmony reexport Autocomplete */__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return external_this_wp_blockEditor_["Autocomplete"]; }); |
|
15236 /* concated harmony reexport AlignmentToolbar */__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return external_this_wp_blockEditor_["AlignmentToolbar"]; }); |
|
15237 /* concated harmony reexport BlockAlignmentToolbar */__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return external_this_wp_blockEditor_["BlockAlignmentToolbar"]; }); |
|
15238 /* concated harmony reexport BlockControls */__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return external_this_wp_blockEditor_["BlockControls"]; }); |
|
15239 /* concated harmony reexport BlockEdit */__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return external_this_wp_blockEditor_["BlockEdit"]; }); |
|
15240 /* concated harmony reexport BlockEditorKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"]; }); |
|
15241 /* concated harmony reexport BlockFormatControls */__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return external_this_wp_blockEditor_["BlockFormatControls"]; }); |
|
15242 /* concated harmony reexport BlockIcon */__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return external_this_wp_blockEditor_["BlockIcon"]; }); |
|
15243 /* concated harmony reexport BlockInspector */__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return external_this_wp_blockEditor_["BlockInspector"]; }); |
|
15244 /* concated harmony reexport BlockList */__webpack_require__.d(__webpack_exports__, "BlockList", function() { return external_this_wp_blockEditor_["BlockList"]; }); |
|
15245 /* concated harmony reexport BlockMover */__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return external_this_wp_blockEditor_["BlockMover"]; }); |
|
15246 /* concated harmony reexport BlockNavigationDropdown */__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return external_this_wp_blockEditor_["BlockNavigationDropdown"]; }); |
|
15247 /* concated harmony reexport BlockSelectionClearer */__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return external_this_wp_blockEditor_["BlockSelectionClearer"]; }); |
|
15248 /* concated harmony reexport BlockSettingsMenu */__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return external_this_wp_blockEditor_["BlockSettingsMenu"]; }); |
|
15249 /* concated harmony reexport BlockTitle */__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return external_this_wp_blockEditor_["BlockTitle"]; }); |
|
15250 /* concated harmony reexport BlockToolbar */__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return external_this_wp_blockEditor_["BlockToolbar"]; }); |
|
15251 /* concated harmony reexport ColorPalette */__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return external_this_wp_blockEditor_["ColorPalette"]; }); |
|
15252 /* concated harmony reexport ContrastChecker */__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return external_this_wp_blockEditor_["ContrastChecker"]; }); |
|
15253 /* concated harmony reexport CopyHandler */__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return external_this_wp_blockEditor_["CopyHandler"]; }); |
|
15254 /* concated harmony reexport createCustomColorsHOC */__webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return external_this_wp_blockEditor_["createCustomColorsHOC"]; }); |
|
15255 /* concated harmony reexport DefaultBlockAppender */__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return external_this_wp_blockEditor_["DefaultBlockAppender"]; }); |
|
15256 /* concated harmony reexport FontSizePicker */__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return external_this_wp_blockEditor_["FontSizePicker"]; }); |
|
15257 /* concated harmony reexport getColorClassName */__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return external_this_wp_blockEditor_["getColorClassName"]; }); |
|
15258 /* concated harmony reexport getColorObjectByAttributeValues */__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return external_this_wp_blockEditor_["getColorObjectByAttributeValues"]; }); |
|
15259 /* concated harmony reexport getColorObjectByColorValue */__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return external_this_wp_blockEditor_["getColorObjectByColorValue"]; }); |
|
15260 /* concated harmony reexport getFontSize */__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return external_this_wp_blockEditor_["getFontSize"]; }); |
|
15261 /* concated harmony reexport getFontSizeClass */__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return external_this_wp_blockEditor_["getFontSizeClass"]; }); |
|
15262 /* concated harmony reexport Inserter */__webpack_require__.d(__webpack_exports__, "Inserter", function() { return external_this_wp_blockEditor_["Inserter"]; }); |
|
15263 /* concated harmony reexport InnerBlocks */__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return external_this_wp_blockEditor_["InnerBlocks"]; }); |
|
15264 /* concated harmony reexport InspectorAdvancedControls */__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return external_this_wp_blockEditor_["InspectorAdvancedControls"]; }); |
|
15265 /* concated harmony reexport InspectorControls */__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return external_this_wp_blockEditor_["InspectorControls"]; }); |
|
15266 /* concated harmony reexport PanelColorSettings */__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return external_this_wp_blockEditor_["PanelColorSettings"]; }); |
|
15267 /* concated harmony reexport PlainText */__webpack_require__.d(__webpack_exports__, "PlainText", function() { return external_this_wp_blockEditor_["PlainText"]; }); |
|
15268 /* concated harmony reexport RichText */__webpack_require__.d(__webpack_exports__, "RichText", function() { return external_this_wp_blockEditor_["RichText"]; }); |
|
15269 /* concated harmony reexport RichTextShortcut */__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return external_this_wp_blockEditor_["RichTextShortcut"]; }); |
|
15270 /* concated harmony reexport RichTextToolbarButton */__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return external_this_wp_blockEditor_["RichTextToolbarButton"]; }); |
|
15271 /* concated harmony reexport RichTextInserterItem */__webpack_require__.d(__webpack_exports__, "RichTextInserterItem", function() { return external_this_wp_blockEditor_["RichTextInserterItem"]; }); |
|
15272 /* concated harmony reexport UnstableRichTextInputEvent */__webpack_require__.d(__webpack_exports__, "UnstableRichTextInputEvent", function() { return external_this_wp_blockEditor_["UnstableRichTextInputEvent"]; }); |
|
15273 /* concated harmony reexport MediaPlaceholder */__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return external_this_wp_blockEditor_["MediaPlaceholder"]; }); |
|
15274 /* concated harmony reexport MediaUpload */__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return external_this_wp_blockEditor_["MediaUpload"]; }); |
|
15275 /* concated harmony reexport MediaUploadCheck */__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return external_this_wp_blockEditor_["MediaUploadCheck"]; }); |
|
15276 /* concated harmony reexport MultiBlocksSwitcher */__webpack_require__.d(__webpack_exports__, "MultiBlocksSwitcher", function() { return external_this_wp_blockEditor_["MultiBlocksSwitcher"]; }); |
|
15277 /* concated harmony reexport MultiSelectScrollIntoView */__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return external_this_wp_blockEditor_["MultiSelectScrollIntoView"]; }); |
|
15278 /* concated harmony reexport NavigableToolbar */__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return external_this_wp_blockEditor_["NavigableToolbar"]; }); |
|
15279 /* concated harmony reexport ObserveTyping */__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return external_this_wp_blockEditor_["ObserveTyping"]; }); |
|
15280 /* concated harmony reexport PreserveScrollInReorder */__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return external_this_wp_blockEditor_["PreserveScrollInReorder"]; }); |
|
15281 /* concated harmony reexport SkipToSelectedBlock */__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return external_this_wp_blockEditor_["SkipToSelectedBlock"]; }); |
|
15282 /* concated harmony reexport URLInput */__webpack_require__.d(__webpack_exports__, "URLInput", function() { return external_this_wp_blockEditor_["URLInput"]; }); |
|
15283 /* concated harmony reexport URLInputButton */__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return external_this_wp_blockEditor_["URLInputButton"]; }); |
|
15284 /* concated harmony reexport URLPopover */__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return external_this_wp_blockEditor_["URLPopover"]; }); |
|
15285 /* concated harmony reexport Warning */__webpack_require__.d(__webpack_exports__, "Warning", function() { return external_this_wp_blockEditor_["Warning"]; }); |
|
15286 /* concated harmony reexport WritingFlow */__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return external_this_wp_blockEditor_["WritingFlow"]; }); |
|
15287 /* concated harmony reexport withColorContext */__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return external_this_wp_blockEditor_["withColorContext"]; }); |
|
15288 /* concated harmony reexport withColors */__webpack_require__.d(__webpack_exports__, "withColors", function() { return external_this_wp_blockEditor_["withColors"]; }); |
|
15289 /* concated harmony reexport withFontSizes */__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return external_this_wp_blockEditor_["withFontSizes"]; }); |
|
15290 /* concated harmony reexport mediaUpload */__webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return media_upload; }); |
|
15291 /* concated harmony reexport cleanForSlug */__webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return cleanForSlug; }); |
|
15292 /* concated harmony reexport transformStyles */__webpack_require__.d(__webpack_exports__, "transformStyles", function() { return editor_styles; }); |
|
15293 /** |
|
15294 * WordPress dependencies |
|
15295 */ |
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 |
|
15302 |
|
15303 /** |
|
15304 * Internal dependencies |
|
15305 */ |
|
15306 |
|
15307 |
|
15308 |
|
15309 |
|
15310 |
|
15311 |
|
15312 |
|
15313 |
14186 |
15314 /***/ }), |
14187 /***/ }), |
15315 |
14188 |
15316 /***/ 37: |
14189 /***/ 50: |
15317 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
15318 |
|
15319 "use strict"; |
|
15320 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
|
15321 function _arrayWithHoles(arr) { |
|
15322 if (Array.isArray(arr)) return arr; |
|
15323 } |
|
15324 |
|
15325 /***/ }), |
|
15326 |
|
15327 /***/ 38: |
|
15328 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
15329 |
|
15330 "use strict"; |
|
15331 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
|
15332 function _nonIterableRest() { |
|
15333 throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
15334 } |
|
15335 |
|
15336 /***/ }), |
|
15337 |
|
15338 /***/ 4: |
|
15339 /***/ (function(module, exports) { |
|
15340 |
|
15341 (function() { module.exports = this["wp"]["components"]; }()); |
|
15342 |
|
15343 /***/ }), |
|
15344 |
|
15345 /***/ 40: |
|
15346 /***/ (function(module, exports) { |
|
15347 |
|
15348 (function() { module.exports = this["wp"]["viewport"]; }()); |
|
15349 |
|
15350 /***/ }), |
|
15351 |
|
15352 /***/ 41: |
|
15353 /***/ (function(module, exports, __webpack_require__) { |
|
15354 |
|
15355 module.exports = function memize( fn, options ) { |
|
15356 var size = 0, |
|
15357 maxSize, head, tail; |
|
15358 |
|
15359 if ( options && options.maxSize ) { |
|
15360 maxSize = options.maxSize; |
|
15361 } |
|
15362 |
|
15363 function memoized( /* ...args */ ) { |
|
15364 var node = head, |
|
15365 len = arguments.length, |
|
15366 args, i; |
|
15367 |
|
15368 searchCache: while ( node ) { |
|
15369 // Perform a shallow equality test to confirm that whether the node |
|
15370 // under test is a candidate for the arguments passed. Two arrays |
|
15371 // are shallowly equal if their length matches and each entry is |
|
15372 // strictly equal between the two sets. Avoid abstracting to a |
|
15373 // function which could incur an arguments leaking deoptimization. |
|
15374 |
|
15375 // Check whether node arguments match arguments length |
|
15376 if ( node.args.length !== arguments.length ) { |
|
15377 node = node.next; |
|
15378 continue; |
|
15379 } |
|
15380 |
|
15381 // Check whether node arguments match arguments values |
|
15382 for ( i = 0; i < len; i++ ) { |
|
15383 if ( node.args[ i ] !== arguments[ i ] ) { |
|
15384 node = node.next; |
|
15385 continue searchCache; |
|
15386 } |
|
15387 } |
|
15388 |
|
15389 // At this point we can assume we've found a match |
|
15390 |
|
15391 // Surface matched node to head if not already |
|
15392 if ( node !== head ) { |
|
15393 // As tail, shift to previous. Must only shift if not also |
|
15394 // head, since if both head and tail, there is no previous. |
|
15395 if ( node === tail ) { |
|
15396 tail = node.prev; |
|
15397 } |
|
15398 |
|
15399 // Adjust siblings to point to each other. If node was tail, |
|
15400 // this also handles new tail's empty `next` assignment. |
|
15401 node.prev.next = node.next; |
|
15402 if ( node.next ) { |
|
15403 node.next.prev = node.prev; |
|
15404 } |
|
15405 |
|
15406 node.next = head; |
|
15407 node.prev = null; |
|
15408 head.prev = node; |
|
15409 head = node; |
|
15410 } |
|
15411 |
|
15412 // Return immediately |
|
15413 return node.val; |
|
15414 } |
|
15415 |
|
15416 // No cached value found. Continue to insertion phase: |
|
15417 |
|
15418 // Create a copy of arguments (avoid leaking deoptimization) |
|
15419 args = new Array( len ); |
|
15420 for ( i = 0; i < len; i++ ) { |
|
15421 args[ i ] = arguments[ i ]; |
|
15422 } |
|
15423 |
|
15424 node = { |
|
15425 args: args, |
|
15426 |
|
15427 // Generate the result from original function |
|
15428 val: fn.apply( null, args ) |
|
15429 }; |
|
15430 |
|
15431 // Don't need to check whether node is already head, since it would |
|
15432 // have been returned above already if it was |
|
15433 |
|
15434 // Shift existing head down list |
|
15435 if ( head ) { |
|
15436 head.prev = node; |
|
15437 node.next = head; |
|
15438 } else { |
|
15439 // If no head, follows that there's no tail (at initial or reset) |
|
15440 tail = node; |
|
15441 } |
|
15442 |
|
15443 // Trim tail if we're reached max size and are pending cache insertion |
|
15444 if ( size === maxSize ) { |
|
15445 tail = tail.prev; |
|
15446 tail.next = null; |
|
15447 } else { |
|
15448 size++; |
|
15449 } |
|
15450 |
|
15451 head = node; |
|
15452 |
|
15453 return node.val; |
|
15454 } |
|
15455 |
|
15456 memoized.clear = function() { |
|
15457 head = null; |
|
15458 tail = null; |
|
15459 size = 0; |
|
15460 }; |
|
15461 |
|
15462 if ( false ) {} |
|
15463 |
|
15464 return memoized; |
|
15465 }; |
|
15466 |
|
15467 |
|
15468 /***/ }), |
|
15469 |
|
15470 /***/ 44: |
|
15471 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
14190 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
15472 |
14191 |
15473 "use strict"; |
14192 "use strict"; |
15474 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); |
14193 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); |
15475 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
14194 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
15508 }; |
14227 }; |
15509 } |
14228 } |
15510 |
14229 |
15511 /***/ }), |
14230 /***/ }), |
15512 |
14231 |
15513 /***/ 49: |
14232 /***/ 52: |
15514 /***/ (function(module, exports) { |
14233 /***/ (function(module, exports) { |
15515 |
14234 |
15516 (function() { module.exports = this["wp"]["deprecated"]; }()); |
14235 (function() { module.exports = this["wp"]["keyboardShortcuts"]; }()); |
15517 |
14236 |
15518 /***/ }), |
14237 /***/ }), |
15519 |
14238 |
15520 /***/ 5: |
14239 /***/ 6: |
15521 /***/ (function(module, exports) { |
14240 /***/ (function(module, exports) { |
15522 |
14241 |
15523 (function() { module.exports = this["wp"]["data"]; }()); |
14242 (function() { module.exports = this["wp"]["primitives"]; }()); |
15524 |
14243 |
15525 /***/ }), |
14244 /***/ }), |
15526 |
14245 |
15527 /***/ 50: |
14246 /***/ 60: |
14247 /***/ (function(module, exports, __webpack_require__) { |
|
14248 |
|
14249 /** |
|
14250 * Memize options object. |
|
14251 * |
|
14252 * @typedef MemizeOptions |
|
14253 * |
|
14254 * @property {number} [maxSize] Maximum size of the cache. |
|
14255 */ |
|
14256 |
|
14257 /** |
|
14258 * Internal cache entry. |
|
14259 * |
|
14260 * @typedef MemizeCacheNode |
|
14261 * |
|
14262 * @property {?MemizeCacheNode|undefined} [prev] Previous node. |
|
14263 * @property {?MemizeCacheNode|undefined} [next] Next node. |
|
14264 * @property {Array<*>} args Function arguments for cache |
|
14265 * entry. |
|
14266 * @property {*} val Function result. |
|
14267 */ |
|
14268 |
|
14269 /** |
|
14270 * Properties of the enhanced function for controlling cache. |
|
14271 * |
|
14272 * @typedef MemizeMemoizedFunction |
|
14273 * |
|
14274 * @property {()=>void} clear Clear the cache. |
|
14275 */ |
|
14276 |
|
14277 /** |
|
14278 * Accepts a function to be memoized, and returns a new memoized function, with |
|
14279 * optional options. |
|
14280 * |
|
14281 * @template {Function} F |
|
14282 * |
|
14283 * @param {F} fn Function to memoize. |
|
14284 * @param {MemizeOptions} [options] Options object. |
|
14285 * |
|
14286 * @return {F & MemizeMemoizedFunction} Memoized function. |
|
14287 */ |
|
14288 function memize( fn, options ) { |
|
14289 var size = 0; |
|
14290 |
|
14291 /** @type {?MemizeCacheNode|undefined} */ |
|
14292 var head; |
|
14293 |
|
14294 /** @type {?MemizeCacheNode|undefined} */ |
|
14295 var tail; |
|
14296 |
|
14297 options = options || {}; |
|
14298 |
|
14299 function memoized( /* ...args */ ) { |
|
14300 var node = head, |
|
14301 len = arguments.length, |
|
14302 args, i; |
|
14303 |
|
14304 searchCache: while ( node ) { |
|
14305 // Perform a shallow equality test to confirm that whether the node |
|
14306 // under test is a candidate for the arguments passed. Two arrays |
|
14307 // are shallowly equal if their length matches and each entry is |
|
14308 // strictly equal between the two sets. Avoid abstracting to a |
|
14309 // function which could incur an arguments leaking deoptimization. |
|
14310 |
|
14311 // Check whether node arguments match arguments length |
|
14312 if ( node.args.length !== arguments.length ) { |
|
14313 node = node.next; |
|
14314 continue; |
|
14315 } |
|
14316 |
|
14317 // Check whether node arguments match arguments values |
|
14318 for ( i = 0; i < len; i++ ) { |
|
14319 if ( node.args[ i ] !== arguments[ i ] ) { |
|
14320 node = node.next; |
|
14321 continue searchCache; |
|
14322 } |
|
14323 } |
|
14324 |
|
14325 // At this point we can assume we've found a match |
|
14326 |
|
14327 // Surface matched node to head if not already |
|
14328 if ( node !== head ) { |
|
14329 // As tail, shift to previous. Must only shift if not also |
|
14330 // head, since if both head and tail, there is no previous. |
|
14331 if ( node === tail ) { |
|
14332 tail = node.prev; |
|
14333 } |
|
14334 |
|
14335 // Adjust siblings to point to each other. If node was tail, |
|
14336 // this also handles new tail's empty `next` assignment. |
|
14337 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; |
|
14338 if ( node.next ) { |
|
14339 node.next.prev = node.prev; |
|
14340 } |
|
14341 |
|
14342 node.next = head; |
|
14343 node.prev = null; |
|
14344 /** @type {MemizeCacheNode} */ ( head ).prev = node; |
|
14345 head = node; |
|
14346 } |
|
14347 |
|
14348 // Return immediately |
|
14349 return node.val; |
|
14350 } |
|
14351 |
|
14352 // No cached value found. Continue to insertion phase: |
|
14353 |
|
14354 // Create a copy of arguments (avoid leaking deoptimization) |
|
14355 args = new Array( len ); |
|
14356 for ( i = 0; i < len; i++ ) { |
|
14357 args[ i ] = arguments[ i ]; |
|
14358 } |
|
14359 |
|
14360 node = { |
|
14361 args: args, |
|
14362 |
|
14363 // Generate the result from original function |
|
14364 val: fn.apply( null, args ), |
|
14365 }; |
|
14366 |
|
14367 // Don't need to check whether node is already head, since it would |
|
14368 // have been returned above already if it was |
|
14369 |
|
14370 // Shift existing head down list |
|
14371 if ( head ) { |
|
14372 head.prev = node; |
|
14373 node.next = head; |
|
14374 } else { |
|
14375 // If no head, follows that there's no tail (at initial or reset) |
|
14376 tail = node; |
|
14377 } |
|
14378 |
|
14379 // Trim tail if we're reached max size and are pending cache insertion |
|
14380 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { |
|
14381 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; |
|
14382 /** @type {MemizeCacheNode} */ ( tail ).next = null; |
|
14383 } else { |
|
14384 size++; |
|
14385 } |
|
14386 |
|
14387 head = node; |
|
14388 |
|
14389 return node.val; |
|
14390 } |
|
14391 |
|
14392 memoized.clear = function() { |
|
14393 head = null; |
|
14394 tail = null; |
|
14395 size = 0; |
|
14396 }; |
|
14397 |
|
14398 if ( false ) {} |
|
14399 |
|
14400 // Ignore reason: There's not a clear solution to create an intersection of |
|
14401 // the function with additional properties, where the goal is to retain the |
|
14402 // function signature of the incoming argument and add control properties |
|
14403 // on the return value. |
|
14404 |
|
14405 // @ts-ignore |
|
14406 return memoized; |
|
14407 } |
|
14408 |
|
14409 module.exports = memize; |
|
14410 |
|
14411 |
|
14412 /***/ }), |
|
14413 |
|
14414 /***/ 7: |
|
15528 /***/ (function(module, exports) { |
14415 /***/ (function(module, exports) { |
15529 |
14416 |
14417 (function() { module.exports = this["wp"]["blockEditor"]; }()); |
|
14418 |
|
14419 /***/ }), |
|
14420 |
|
14421 /***/ 75: |
|
14422 /***/ (function(module, exports) { |
|
14423 |
|
14424 (function() { module.exports = this["wp"]["htmlEntities"]; }()); |
|
14425 |
|
14426 /***/ }), |
|
14427 |
|
14428 /***/ 79: |
|
14429 /***/ (function(module, exports) { |
|
14430 |
|
15530 (function() { module.exports = this["wp"]["date"]; }()); |
14431 (function() { module.exports = this["wp"]["date"]; }()); |
15531 |
14432 |
15532 /***/ }), |
14433 /***/ }), |
15533 |
14434 |
15534 /***/ 54: |
14435 /***/ 8: |
15535 /***/ (function(module, exports, __webpack_require__) { |
14436 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
15536 |
14437 |
15537 /** |
14438 "use strict"; |
15538 * Copyright (c) 2014-present, Facebook, Inc. |
14439 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
15539 * |
14440 function _extends() { |
15540 * This source code is licensed under the MIT license found in the |
14441 _extends = Object.assign || function (target) { |
15541 * LICENSE file in the root directory of this source tree. |
14442 for (var i = 1; i < arguments.length; i++) { |
15542 */ |
14443 var source = arguments[i]; |
15543 |
14444 |
15544 // This method of obtaining a reference to the global object needs to be |
14445 for (var key in source) { |
15545 // kept identical to the way it is obtained in runtime.js |
14446 if (Object.prototype.hasOwnProperty.call(source, key)) { |
15546 var g = (function() { |
14447 target[key] = source[key]; |
15547 return this || (typeof self === "object" && self); |
|
15548 })() || Function("return this")(); |
|
15549 |
|
15550 // Use `getOwnPropertyNames` because not all browsers support calling |
|
15551 // `hasOwnProperty` on the global `self` object in a worker. See #183. |
|
15552 var hadRuntime = g.regeneratorRuntime && |
|
15553 Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; |
|
15554 |
|
15555 // Save the old regeneratorRuntime in case it needs to be restored later. |
|
15556 var oldRuntime = hadRuntime && g.regeneratorRuntime; |
|
15557 |
|
15558 // Force reevalutation of runtime.js. |
|
15559 g.regeneratorRuntime = undefined; |
|
15560 |
|
15561 module.exports = __webpack_require__(55); |
|
15562 |
|
15563 if (hadRuntime) { |
|
15564 // Restore the original runtime. |
|
15565 g.regeneratorRuntime = oldRuntime; |
|
15566 } else { |
|
15567 // Remove the global property added by runtime.js. |
|
15568 try { |
|
15569 delete g.regeneratorRuntime; |
|
15570 } catch(e) { |
|
15571 g.regeneratorRuntime = undefined; |
|
15572 } |
|
15573 } |
|
15574 |
|
15575 |
|
15576 /***/ }), |
|
15577 |
|
15578 /***/ 55: |
|
15579 /***/ (function(module, exports) { |
|
15580 |
|
15581 /** |
|
15582 * Copyright (c) 2014-present, Facebook, Inc. |
|
15583 * |
|
15584 * This source code is licensed under the MIT license found in the |
|
15585 * LICENSE file in the root directory of this source tree. |
|
15586 */ |
|
15587 |
|
15588 !(function(global) { |
|
15589 "use strict"; |
|
15590 |
|
15591 var Op = Object.prototype; |
|
15592 var hasOwn = Op.hasOwnProperty; |
|
15593 var undefined; // More compressible than void 0. |
|
15594 var $Symbol = typeof Symbol === "function" ? Symbol : {}; |
|
15595 var iteratorSymbol = $Symbol.iterator || "@@iterator"; |
|
15596 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; |
|
15597 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; |
|
15598 |
|
15599 var inModule = typeof module === "object"; |
|
15600 var runtime = global.regeneratorRuntime; |
|
15601 if (runtime) { |
|
15602 if (inModule) { |
|
15603 // If regeneratorRuntime is defined globally and we're in a module, |
|
15604 // make the exports object identical to regeneratorRuntime. |
|
15605 module.exports = runtime; |
|
15606 } |
|
15607 // Don't bother evaluating the rest of this file if the runtime was |
|
15608 // already defined globally. |
|
15609 return; |
|
15610 } |
|
15611 |
|
15612 // Define the runtime globally (as expected by generated code) as either |
|
15613 // module.exports (if we're in a module) or a new, empty object. |
|
15614 runtime = global.regeneratorRuntime = inModule ? module.exports : {}; |
|
15615 |
|
15616 function wrap(innerFn, outerFn, self, tryLocsList) { |
|
15617 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. |
|
15618 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; |
|
15619 var generator = Object.create(protoGenerator.prototype); |
|
15620 var context = new Context(tryLocsList || []); |
|
15621 |
|
15622 // The ._invoke method unifies the implementations of the .next, |
|
15623 // .throw, and .return methods. |
|
15624 generator._invoke = makeInvokeMethod(innerFn, self, context); |
|
15625 |
|
15626 return generator; |
|
15627 } |
|
15628 runtime.wrap = wrap; |
|
15629 |
|
15630 // Try/catch helper to minimize deoptimizations. Returns a completion |
|
15631 // record like context.tryEntries[i].completion. This interface could |
|
15632 // have been (and was previously) designed to take a closure to be |
|
15633 // invoked without arguments, but in all the cases we care about we |
|
15634 // already have an existing method we want to call, so there's no need |
|
15635 // to create a new function object. We can even get away with assuming |
|
15636 // the method takes exactly one argument, since that happens to be true |
|
15637 // in every case, so we don't have to touch the arguments object. The |
|
15638 // only additional allocation required is the completion record, which |
|
15639 // has a stable shape and so hopefully should be cheap to allocate. |
|
15640 function tryCatch(fn, obj, arg) { |
|
15641 try { |
|
15642 return { type: "normal", arg: fn.call(obj, arg) }; |
|
15643 } catch (err) { |
|
15644 return { type: "throw", arg: err }; |
|
15645 } |
|
15646 } |
|
15647 |
|
15648 var GenStateSuspendedStart = "suspendedStart"; |
|
15649 var GenStateSuspendedYield = "suspendedYield"; |
|
15650 var GenStateExecuting = "executing"; |
|
15651 var GenStateCompleted = "completed"; |
|
15652 |
|
15653 // Returning this object from the innerFn has the same effect as |
|
15654 // breaking out of the dispatch switch statement. |
|
15655 var ContinueSentinel = {}; |
|
15656 |
|
15657 // Dummy constructor functions that we use as the .constructor and |
|
15658 // .constructor.prototype properties for functions that return Generator |
|
15659 // objects. For full spec compliance, you may wish to configure your |
|
15660 // minifier not to mangle the names of these two functions. |
|
15661 function Generator() {} |
|
15662 function GeneratorFunction() {} |
|
15663 function GeneratorFunctionPrototype() {} |
|
15664 |
|
15665 // This is a polyfill for %IteratorPrototype% for environments that |
|
15666 // don't natively support it. |
|
15667 var IteratorPrototype = {}; |
|
15668 IteratorPrototype[iteratorSymbol] = function () { |
|
15669 return this; |
|
15670 }; |
|
15671 |
|
15672 var getProto = Object.getPrototypeOf; |
|
15673 var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); |
|
15674 if (NativeIteratorPrototype && |
|
15675 NativeIteratorPrototype !== Op && |
|
15676 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { |
|
15677 // This environment has a native %IteratorPrototype%; use it instead |
|
15678 // of the polyfill. |
|
15679 IteratorPrototype = NativeIteratorPrototype; |
|
15680 } |
|
15681 |
|
15682 var Gp = GeneratorFunctionPrototype.prototype = |
|
15683 Generator.prototype = Object.create(IteratorPrototype); |
|
15684 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; |
|
15685 GeneratorFunctionPrototype.constructor = GeneratorFunction; |
|
15686 GeneratorFunctionPrototype[toStringTagSymbol] = |
|
15687 GeneratorFunction.displayName = "GeneratorFunction"; |
|
15688 |
|
15689 // Helper for defining the .next, .throw, and .return methods of the |
|
15690 // Iterator interface in terms of a single ._invoke method. |
|
15691 function defineIteratorMethods(prototype) { |
|
15692 ["next", "throw", "return"].forEach(function(method) { |
|
15693 prototype[method] = function(arg) { |
|
15694 return this._invoke(method, arg); |
|
15695 }; |
|
15696 }); |
|
15697 } |
|
15698 |
|
15699 runtime.isGeneratorFunction = function(genFun) { |
|
15700 var ctor = typeof genFun === "function" && genFun.constructor; |
|
15701 return ctor |
|
15702 ? ctor === GeneratorFunction || |
|
15703 // For the native GeneratorFunction constructor, the best we can |
|
15704 // do is to check its .name property. |
|
15705 (ctor.displayName || ctor.name) === "GeneratorFunction" |
|
15706 : false; |
|
15707 }; |
|
15708 |
|
15709 runtime.mark = function(genFun) { |
|
15710 if (Object.setPrototypeOf) { |
|
15711 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); |
|
15712 } else { |
|
15713 genFun.__proto__ = GeneratorFunctionPrototype; |
|
15714 if (!(toStringTagSymbol in genFun)) { |
|
15715 genFun[toStringTagSymbol] = "GeneratorFunction"; |
|
15716 } |
|
15717 } |
|
15718 genFun.prototype = Object.create(Gp); |
|
15719 return genFun; |
|
15720 }; |
|
15721 |
|
15722 // Within the body of any async function, `await x` is transformed to |
|
15723 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test |
|
15724 // `hasOwn.call(value, "__await")` to determine if the yielded value is |
|
15725 // meant to be awaited. |
|
15726 runtime.awrap = function(arg) { |
|
15727 return { __await: arg }; |
|
15728 }; |
|
15729 |
|
15730 function AsyncIterator(generator) { |
|
15731 function invoke(method, arg, resolve, reject) { |
|
15732 var record = tryCatch(generator[method], generator, arg); |
|
15733 if (record.type === "throw") { |
|
15734 reject(record.arg); |
|
15735 } else { |
|
15736 var result = record.arg; |
|
15737 var value = result.value; |
|
15738 if (value && |
|
15739 typeof value === "object" && |
|
15740 hasOwn.call(value, "__await")) { |
|
15741 return Promise.resolve(value.__await).then(function(value) { |
|
15742 invoke("next", value, resolve, reject); |
|
15743 }, function(err) { |
|
15744 invoke("throw", err, resolve, reject); |
|
15745 }); |
|
15746 } |
|
15747 |
|
15748 return Promise.resolve(value).then(function(unwrapped) { |
|
15749 // When a yielded Promise is resolved, its final value becomes |
|
15750 // the .value of the Promise<{value,done}> result for the |
|
15751 // current iteration. |
|
15752 result.value = unwrapped; |
|
15753 resolve(result); |
|
15754 }, function(error) { |
|
15755 // If a rejected Promise was yielded, throw the rejection back |
|
15756 // into the async generator function so it can be handled there. |
|
15757 return invoke("throw", error, resolve, reject); |
|
15758 }); |
|
15759 } |
|
15760 } |
|
15761 |
|
15762 var previousPromise; |
|
15763 |
|
15764 function enqueue(method, arg) { |
|
15765 function callInvokeWithMethodAndArg() { |
|
15766 return new Promise(function(resolve, reject) { |
|
15767 invoke(method, arg, resolve, reject); |
|
15768 }); |
|
15769 } |
|
15770 |
|
15771 return previousPromise = |
|
15772 // If enqueue has been called before, then we want to wait until |
|
15773 // all previous Promises have been resolved before calling invoke, |
|
15774 // so that results are always delivered in the correct order. If |
|
15775 // enqueue has not been called before, then it is important to |
|
15776 // call invoke immediately, without waiting on a callback to fire, |
|
15777 // so that the async generator function has the opportunity to do |
|
15778 // any necessary setup in a predictable way. This predictability |
|
15779 // is why the Promise constructor synchronously invokes its |
|
15780 // executor callback, and why async functions synchronously |
|
15781 // execute code before the first await. Since we implement simple |
|
15782 // async functions in terms of async generators, it is especially |
|
15783 // important to get this right, even though it requires care. |
|
15784 previousPromise ? previousPromise.then( |
|
15785 callInvokeWithMethodAndArg, |
|
15786 // Avoid propagating failures to Promises returned by later |
|
15787 // invocations of the iterator. |
|
15788 callInvokeWithMethodAndArg |
|
15789 ) : callInvokeWithMethodAndArg(); |
|
15790 } |
|
15791 |
|
15792 // Define the unified helper method that is used to implement .next, |
|
15793 // .throw, and .return (see defineIteratorMethods). |
|
15794 this._invoke = enqueue; |
|
15795 } |
|
15796 |
|
15797 defineIteratorMethods(AsyncIterator.prototype); |
|
15798 AsyncIterator.prototype[asyncIteratorSymbol] = function () { |
|
15799 return this; |
|
15800 }; |
|
15801 runtime.AsyncIterator = AsyncIterator; |
|
15802 |
|
15803 // Note that simple async functions are implemented on top of |
|
15804 // AsyncIterator objects; they just return a Promise for the value of |
|
15805 // the final result produced by the iterator. |
|
15806 runtime.async = function(innerFn, outerFn, self, tryLocsList) { |
|
15807 var iter = new AsyncIterator( |
|
15808 wrap(innerFn, outerFn, self, tryLocsList) |
|
15809 ); |
|
15810 |
|
15811 return runtime.isGeneratorFunction(outerFn) |
|
15812 ? iter // If outerFn is a generator, return the full iterator. |
|
15813 : iter.next().then(function(result) { |
|
15814 return result.done ? result.value : iter.next(); |
|
15815 }); |
|
15816 }; |
|
15817 |
|
15818 function makeInvokeMethod(innerFn, self, context) { |
|
15819 var state = GenStateSuspendedStart; |
|
15820 |
|
15821 return function invoke(method, arg) { |
|
15822 if (state === GenStateExecuting) { |
|
15823 throw new Error("Generator is already running"); |
|
15824 } |
|
15825 |
|
15826 if (state === GenStateCompleted) { |
|
15827 if (method === "throw") { |
|
15828 throw arg; |
|
15829 } |
|
15830 |
|
15831 // Be forgiving, per 25.3.3.3.3 of the spec: |
|
15832 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume |
|
15833 return doneResult(); |
|
15834 } |
|
15835 |
|
15836 context.method = method; |
|
15837 context.arg = arg; |
|
15838 |
|
15839 while (true) { |
|
15840 var delegate = context.delegate; |
|
15841 if (delegate) { |
|
15842 var delegateResult = maybeInvokeDelegate(delegate, context); |
|
15843 if (delegateResult) { |
|
15844 if (delegateResult === ContinueSentinel) continue; |
|
15845 return delegateResult; |
|
15846 } |
|
15847 } |
|
15848 |
|
15849 if (context.method === "next") { |
|
15850 // Setting context._sent for legacy support of Babel's |
|
15851 // function.sent implementation. |
|
15852 context.sent = context._sent = context.arg; |
|
15853 |
|
15854 } else if (context.method === "throw") { |
|
15855 if (state === GenStateSuspendedStart) { |
|
15856 state = GenStateCompleted; |
|
15857 throw context.arg; |
|
15858 } |
|
15859 |
|
15860 context.dispatchException(context.arg); |
|
15861 |
|
15862 } else if (context.method === "return") { |
|
15863 context.abrupt("return", context.arg); |
|
15864 } |
|
15865 |
|
15866 state = GenStateExecuting; |
|
15867 |
|
15868 var record = tryCatch(innerFn, self, context); |
|
15869 if (record.type === "normal") { |
|
15870 // If an exception is thrown from innerFn, we leave state === |
|
15871 // GenStateExecuting and loop back for another invocation. |
|
15872 state = context.done |
|
15873 ? GenStateCompleted |
|
15874 : GenStateSuspendedYield; |
|
15875 |
|
15876 if (record.arg === ContinueSentinel) { |
|
15877 continue; |
|
15878 } |
|
15879 |
|
15880 return { |
|
15881 value: record.arg, |
|
15882 done: context.done |
|
15883 }; |
|
15884 |
|
15885 } else if (record.type === "throw") { |
|
15886 state = GenStateCompleted; |
|
15887 // Dispatch the exception by looping back around to the |
|
15888 // context.dispatchException(context.arg) call above. |
|
15889 context.method = "throw"; |
|
15890 context.arg = record.arg; |
|
15891 } |
14448 } |
15892 } |
14449 } |
15893 }; |
14450 } |
15894 } |
14451 |
15895 |
14452 return target; |
15896 // Call delegate.iterator[context.method](context.arg) and handle the |
14453 }; |
15897 // result, either by returning a { value, done } result from the |
14454 |
15898 // delegate iterator, or by modifying context.method and context.arg, |
14455 return _extends.apply(this, arguments); |
15899 // setting context.delegate to null, and returning the ContinueSentinel. |
14456 } |
15900 function maybeInvokeDelegate(delegate, context) { |
|
15901 var method = delegate.iterator[context.method]; |
|
15902 if (method === undefined) { |
|
15903 // A .throw or .return when the delegate iterator has no .throw |
|
15904 // method always terminates the yield* loop. |
|
15905 context.delegate = null; |
|
15906 |
|
15907 if (context.method === "throw") { |
|
15908 if (delegate.iterator.return) { |
|
15909 // If the delegate iterator has a return method, give it a |
|
15910 // chance to clean up. |
|
15911 context.method = "return"; |
|
15912 context.arg = undefined; |
|
15913 maybeInvokeDelegate(delegate, context); |
|
15914 |
|
15915 if (context.method === "throw") { |
|
15916 // If maybeInvokeDelegate(context) changed context.method from |
|
15917 // "return" to "throw", let that override the TypeError below. |
|
15918 return ContinueSentinel; |
|
15919 } |
|
15920 } |
|
15921 |
|
15922 context.method = "throw"; |
|
15923 context.arg = new TypeError( |
|
15924 "The iterator does not provide a 'throw' method"); |
|
15925 } |
|
15926 |
|
15927 return ContinueSentinel; |
|
15928 } |
|
15929 |
|
15930 var record = tryCatch(method, delegate.iterator, context.arg); |
|
15931 |
|
15932 if (record.type === "throw") { |
|
15933 context.method = "throw"; |
|
15934 context.arg = record.arg; |
|
15935 context.delegate = null; |
|
15936 return ContinueSentinel; |
|
15937 } |
|
15938 |
|
15939 var info = record.arg; |
|
15940 |
|
15941 if (! info) { |
|
15942 context.method = "throw"; |
|
15943 context.arg = new TypeError("iterator result is not an object"); |
|
15944 context.delegate = null; |
|
15945 return ContinueSentinel; |
|
15946 } |
|
15947 |
|
15948 if (info.done) { |
|
15949 // Assign the result of the finished delegate to the temporary |
|
15950 // variable specified by delegate.resultName (see delegateYield). |
|
15951 context[delegate.resultName] = info.value; |
|
15952 |
|
15953 // Resume execution at the desired location (see delegateYield). |
|
15954 context.next = delegate.nextLoc; |
|
15955 |
|
15956 // If context.method was "throw" but the delegate handled the |
|
15957 // exception, let the outer generator proceed normally. If |
|
15958 // context.method was "next", forget context.arg since it has been |
|
15959 // "consumed" by the delegate iterator. If context.method was |
|
15960 // "return", allow the original .return call to continue in the |
|
15961 // outer generator. |
|
15962 if (context.method !== "return") { |
|
15963 context.method = "next"; |
|
15964 context.arg = undefined; |
|
15965 } |
|
15966 |
|
15967 } else { |
|
15968 // Re-yield the result returned by the delegate method. |
|
15969 return info; |
|
15970 } |
|
15971 |
|
15972 // The delegate iterator is finished, so forget it and continue with |
|
15973 // the outer generator. |
|
15974 context.delegate = null; |
|
15975 return ContinueSentinel; |
|
15976 } |
|
15977 |
|
15978 // Define Generator.prototype.{next,throw,return} in terms of the |
|
15979 // unified ._invoke helper method. |
|
15980 defineIteratorMethods(Gp); |
|
15981 |
|
15982 Gp[toStringTagSymbol] = "Generator"; |
|
15983 |
|
15984 // A Generator should always return itself as the iterator object when the |
|
15985 // @@iterator function is called on it. Some browsers' implementations of the |
|
15986 // iterator prototype chain incorrectly implement this, causing the Generator |
|
15987 // object to not be returned from this call. This ensures that doesn't happen. |
|
15988 // See https://github.com/facebook/regenerator/issues/274 for more details. |
|
15989 Gp[iteratorSymbol] = function() { |
|
15990 return this; |
|
15991 }; |
|
15992 |
|
15993 Gp.toString = function() { |
|
15994 return "[object Generator]"; |
|
15995 }; |
|
15996 |
|
15997 function pushTryEntry(locs) { |
|
15998 var entry = { tryLoc: locs[0] }; |
|
15999 |
|
16000 if (1 in locs) { |
|
16001 entry.catchLoc = locs[1]; |
|
16002 } |
|
16003 |
|
16004 if (2 in locs) { |
|
16005 entry.finallyLoc = locs[2]; |
|
16006 entry.afterLoc = locs[3]; |
|
16007 } |
|
16008 |
|
16009 this.tryEntries.push(entry); |
|
16010 } |
|
16011 |
|
16012 function resetTryEntry(entry) { |
|
16013 var record = entry.completion || {}; |
|
16014 record.type = "normal"; |
|
16015 delete record.arg; |
|
16016 entry.completion = record; |
|
16017 } |
|
16018 |
|
16019 function Context(tryLocsList) { |
|
16020 // The root entry object (effectively a try statement without a catch |
|
16021 // or a finally block) gives us a place to store values thrown from |
|
16022 // locations where there is no enclosing try statement. |
|
16023 this.tryEntries = [{ tryLoc: "root" }]; |
|
16024 tryLocsList.forEach(pushTryEntry, this); |
|
16025 this.reset(true); |
|
16026 } |
|
16027 |
|
16028 runtime.keys = function(object) { |
|
16029 var keys = []; |
|
16030 for (var key in object) { |
|
16031 keys.push(key); |
|
16032 } |
|
16033 keys.reverse(); |
|
16034 |
|
16035 // Rather than returning an object with a next method, we keep |
|
16036 // things simple and return the next function itself. |
|
16037 return function next() { |
|
16038 while (keys.length) { |
|
16039 var key = keys.pop(); |
|
16040 if (key in object) { |
|
16041 next.value = key; |
|
16042 next.done = false; |
|
16043 return next; |
|
16044 } |
|
16045 } |
|
16046 |
|
16047 // To avoid creating an additional object, we just hang the .value |
|
16048 // and .done properties off the next function object itself. This |
|
16049 // also ensures that the minifier will not anonymize the function. |
|
16050 next.done = true; |
|
16051 return next; |
|
16052 }; |
|
16053 }; |
|
16054 |
|
16055 function values(iterable) { |
|
16056 if (iterable) { |
|
16057 var iteratorMethod = iterable[iteratorSymbol]; |
|
16058 if (iteratorMethod) { |
|
16059 return iteratorMethod.call(iterable); |
|
16060 } |
|
16061 |
|
16062 if (typeof iterable.next === "function") { |
|
16063 return iterable; |
|
16064 } |
|
16065 |
|
16066 if (!isNaN(iterable.length)) { |
|
16067 var i = -1, next = function next() { |
|
16068 while (++i < iterable.length) { |
|
16069 if (hasOwn.call(iterable, i)) { |
|
16070 next.value = iterable[i]; |
|
16071 next.done = false; |
|
16072 return next; |
|
16073 } |
|
16074 } |
|
16075 |
|
16076 next.value = undefined; |
|
16077 next.done = true; |
|
16078 |
|
16079 return next; |
|
16080 }; |
|
16081 |
|
16082 return next.next = next; |
|
16083 } |
|
16084 } |
|
16085 |
|
16086 // Return an iterator with no values. |
|
16087 return { next: doneResult }; |
|
16088 } |
|
16089 runtime.values = values; |
|
16090 |
|
16091 function doneResult() { |
|
16092 return { value: undefined, done: true }; |
|
16093 } |
|
16094 |
|
16095 Context.prototype = { |
|
16096 constructor: Context, |
|
16097 |
|
16098 reset: function(skipTempReset) { |
|
16099 this.prev = 0; |
|
16100 this.next = 0; |
|
16101 // Resetting context._sent for legacy support of Babel's |
|
16102 // function.sent implementation. |
|
16103 this.sent = this._sent = undefined; |
|
16104 this.done = false; |
|
16105 this.delegate = null; |
|
16106 |
|
16107 this.method = "next"; |
|
16108 this.arg = undefined; |
|
16109 |
|
16110 this.tryEntries.forEach(resetTryEntry); |
|
16111 |
|
16112 if (!skipTempReset) { |
|
16113 for (var name in this) { |
|
16114 // Not sure about the optimal order of these conditions: |
|
16115 if (name.charAt(0) === "t" && |
|
16116 hasOwn.call(this, name) && |
|
16117 !isNaN(+name.slice(1))) { |
|
16118 this[name] = undefined; |
|
16119 } |
|
16120 } |
|
16121 } |
|
16122 }, |
|
16123 |
|
16124 stop: function() { |
|
16125 this.done = true; |
|
16126 |
|
16127 var rootEntry = this.tryEntries[0]; |
|
16128 var rootRecord = rootEntry.completion; |
|
16129 if (rootRecord.type === "throw") { |
|
16130 throw rootRecord.arg; |
|
16131 } |
|
16132 |
|
16133 return this.rval; |
|
16134 }, |
|
16135 |
|
16136 dispatchException: function(exception) { |
|
16137 if (this.done) { |
|
16138 throw exception; |
|
16139 } |
|
16140 |
|
16141 var context = this; |
|
16142 function handle(loc, caught) { |
|
16143 record.type = "throw"; |
|
16144 record.arg = exception; |
|
16145 context.next = loc; |
|
16146 |
|
16147 if (caught) { |
|
16148 // If the dispatched exception was caught by a catch block, |
|
16149 // then let that catch block handle the exception normally. |
|
16150 context.method = "next"; |
|
16151 context.arg = undefined; |
|
16152 } |
|
16153 |
|
16154 return !! caught; |
|
16155 } |
|
16156 |
|
16157 for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
|
16158 var entry = this.tryEntries[i]; |
|
16159 var record = entry.completion; |
|
16160 |
|
16161 if (entry.tryLoc === "root") { |
|
16162 // Exception thrown outside of any try block that could handle |
|
16163 // it, so set the completion value of the entire function to |
|
16164 // throw the exception. |
|
16165 return handle("end"); |
|
16166 } |
|
16167 |
|
16168 if (entry.tryLoc <= this.prev) { |
|
16169 var hasCatch = hasOwn.call(entry, "catchLoc"); |
|
16170 var hasFinally = hasOwn.call(entry, "finallyLoc"); |
|
16171 |
|
16172 if (hasCatch && hasFinally) { |
|
16173 if (this.prev < entry.catchLoc) { |
|
16174 return handle(entry.catchLoc, true); |
|
16175 } else if (this.prev < entry.finallyLoc) { |
|
16176 return handle(entry.finallyLoc); |
|
16177 } |
|
16178 |
|
16179 } else if (hasCatch) { |
|
16180 if (this.prev < entry.catchLoc) { |
|
16181 return handle(entry.catchLoc, true); |
|
16182 } |
|
16183 |
|
16184 } else if (hasFinally) { |
|
16185 if (this.prev < entry.finallyLoc) { |
|
16186 return handle(entry.finallyLoc); |
|
16187 } |
|
16188 |
|
16189 } else { |
|
16190 throw new Error("try statement without catch or finally"); |
|
16191 } |
|
16192 } |
|
16193 } |
|
16194 }, |
|
16195 |
|
16196 abrupt: function(type, arg) { |
|
16197 for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
|
16198 var entry = this.tryEntries[i]; |
|
16199 if (entry.tryLoc <= this.prev && |
|
16200 hasOwn.call(entry, "finallyLoc") && |
|
16201 this.prev < entry.finallyLoc) { |
|
16202 var finallyEntry = entry; |
|
16203 break; |
|
16204 } |
|
16205 } |
|
16206 |
|
16207 if (finallyEntry && |
|
16208 (type === "break" || |
|
16209 type === "continue") && |
|
16210 finallyEntry.tryLoc <= arg && |
|
16211 arg <= finallyEntry.finallyLoc) { |
|
16212 // Ignore the finally entry if control is not jumping to a |
|
16213 // location outside the try/catch block. |
|
16214 finallyEntry = null; |
|
16215 } |
|
16216 |
|
16217 var record = finallyEntry ? finallyEntry.completion : {}; |
|
16218 record.type = type; |
|
16219 record.arg = arg; |
|
16220 |
|
16221 if (finallyEntry) { |
|
16222 this.method = "next"; |
|
16223 this.next = finallyEntry.finallyLoc; |
|
16224 return ContinueSentinel; |
|
16225 } |
|
16226 |
|
16227 return this.complete(record); |
|
16228 }, |
|
16229 |
|
16230 complete: function(record, afterLoc) { |
|
16231 if (record.type === "throw") { |
|
16232 throw record.arg; |
|
16233 } |
|
16234 |
|
16235 if (record.type === "break" || |
|
16236 record.type === "continue") { |
|
16237 this.next = record.arg; |
|
16238 } else if (record.type === "return") { |
|
16239 this.rval = this.arg = record.arg; |
|
16240 this.method = "return"; |
|
16241 this.next = "end"; |
|
16242 } else if (record.type === "normal" && afterLoc) { |
|
16243 this.next = afterLoc; |
|
16244 } |
|
16245 |
|
16246 return ContinueSentinel; |
|
16247 }, |
|
16248 |
|
16249 finish: function(finallyLoc) { |
|
16250 for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
|
16251 var entry = this.tryEntries[i]; |
|
16252 if (entry.finallyLoc === finallyLoc) { |
|
16253 this.complete(entry.completion, entry.afterLoc); |
|
16254 resetTryEntry(entry); |
|
16255 return ContinueSentinel; |
|
16256 } |
|
16257 } |
|
16258 }, |
|
16259 |
|
16260 "catch": function(tryLoc) { |
|
16261 for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
|
16262 var entry = this.tryEntries[i]; |
|
16263 if (entry.tryLoc === tryLoc) { |
|
16264 var record = entry.completion; |
|
16265 if (record.type === "throw") { |
|
16266 var thrown = record.arg; |
|
16267 resetTryEntry(entry); |
|
16268 } |
|
16269 return thrown; |
|
16270 } |
|
16271 } |
|
16272 |
|
16273 // The context.catch method must only be called with a location |
|
16274 // argument that corresponds to a known catch block. |
|
16275 throw new Error("illegal catch attempt"); |
|
16276 }, |
|
16277 |
|
16278 delegateYield: function(iterable, resultName, nextLoc) { |
|
16279 this.delegate = { |
|
16280 iterator: values(iterable), |
|
16281 resultName: resultName, |
|
16282 nextLoc: nextLoc |
|
16283 }; |
|
16284 |
|
16285 if (this.method === "next") { |
|
16286 // Deliberately forget the last sent value so that we don't |
|
16287 // accidentally pass it on to the delegate. |
|
16288 this.arg = undefined; |
|
16289 } |
|
16290 |
|
16291 return ContinueSentinel; |
|
16292 } |
|
16293 }; |
|
16294 })( |
|
16295 // In sloppy mode, unbound `this` refers to the global object, fallback to |
|
16296 // Function constructor if we're in global strict mode. That is sadly a form |
|
16297 // of indirect eval which violates Content Security Policy. |
|
16298 (function() { |
|
16299 return this || (typeof self === "object" && self); |
|
16300 })() || Function("return this")() |
|
16301 ); |
|
16302 |
|
16303 |
14457 |
16304 /***/ }), |
14458 /***/ }), |
16305 |
14459 |
16306 /***/ 57: |
14460 /***/ 81: |
16307 /***/ (function(module, exports) { |
14461 /***/ (function(module, exports) { |
16308 |
14462 |
16309 (function() { module.exports = this["wp"]["htmlEntities"]; }()); |
14463 (function() { module.exports = this["wp"]["viewport"]; }()); |
16310 |
14464 |
16311 /***/ }), |
14465 /***/ }), |
16312 |
14466 |
16313 /***/ 59: |
14467 /***/ 83: |
16314 /***/ (function(module, exports) { |
14468 /***/ (function(module, exports) { |
16315 |
14469 |
16316 var g; |
14470 (function() { module.exports = this["wp"]["serverSideRender"]; }()); |
16317 |
|
16318 // This works in non-strict mode |
|
16319 g = (function() { |
|
16320 return this; |
|
16321 })(); |
|
16322 |
|
16323 try { |
|
16324 // This works if eval is allowed (see CSP) |
|
16325 g = g || new Function("return this")(); |
|
16326 } catch (e) { |
|
16327 // This works if the window reference is available |
|
16328 if (typeof window === "object") g = window; |
|
16329 } |
|
16330 |
|
16331 // g can still be undefined, but nothing to do about it... |
|
16332 // We return undefined, instead of nothing here, so it's |
|
16333 // easier to handle this case. if(!global) { ...} |
|
16334 |
|
16335 module.exports = g; |
|
16336 |
|
16337 |
14471 |
16338 /***/ }), |
14472 /***/ }), |
16339 |
14473 |
16340 /***/ 6: |
14474 /***/ 9: |
16341 /***/ (function(module, exports) { |
14475 /***/ (function(module, exports) { |
16342 |
14476 |
16343 (function() { module.exports = this["wp"]["compose"]; }()); |
14477 (function() { module.exports = this["wp"]["compose"]; }()); |
16344 |
|
16345 /***/ }), |
|
16346 |
|
16347 /***/ 60: |
|
16348 /***/ (function(module, exports) { |
|
16349 |
|
16350 (function() { module.exports = this["wp"]["nux"]; }()); |
|
16351 |
|
16352 /***/ }), |
|
16353 |
|
16354 /***/ 61: |
|
16355 /***/ (function(module, exports, __webpack_require__) { |
|
16356 |
|
16357 "use strict"; |
|
16358 |
|
16359 exports.__esModule = true; |
|
16360 var TextareaAutosize_1 = __webpack_require__(111); |
|
16361 exports["default"] = TextareaAutosize_1["default"]; |
|
16362 |
|
16363 |
|
16364 /***/ }), |
|
16365 |
|
16366 /***/ 62: |
|
16367 /***/ (function(module, exports, __webpack_require__) { |
|
16368 |
|
16369 module.exports = __webpack_require__(341); |
|
16370 |
|
16371 |
|
16372 /***/ }), |
|
16373 |
|
16374 /***/ 66: |
|
16375 /***/ (function(module, exports) { |
|
16376 |
|
16377 (function() { module.exports = this["wp"]["autop"]; }()); |
|
16378 |
|
16379 /***/ }), |
|
16380 |
|
16381 /***/ 7: |
|
16382 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
16383 |
|
16384 "use strict"; |
|
16385 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
16386 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
16387 |
|
16388 function _objectSpread(target) { |
|
16389 for (var i = 1; i < arguments.length; i++) { |
|
16390 var source = arguments[i] != null ? arguments[i] : {}; |
|
16391 var ownKeys = Object.keys(source); |
|
16392 |
|
16393 if (typeof Object.getOwnPropertySymbols === 'function') { |
|
16394 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
16395 return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
16396 })); |
|
16397 } |
|
16398 |
|
16399 ownKeys.forEach(function (key) { |
|
16400 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
16401 }); |
|
16402 } |
|
16403 |
|
16404 return target; |
|
16405 } |
|
16406 |
|
16407 /***/ }), |
|
16408 |
|
16409 /***/ 70: |
|
16410 /***/ (function(module, exports, __webpack_require__) { |
|
16411 |
|
16412 "use strict"; |
|
16413 |
|
16414 |
|
16415 function flattenIntoMap( map, effects ) { |
|
16416 var i; |
|
16417 if ( Array.isArray( effects ) ) { |
|
16418 for ( i = 0; i < effects.length; i++ ) { |
|
16419 flattenIntoMap( map, effects[ i ] ); |
|
16420 } |
|
16421 } else { |
|
16422 for ( i in effects ) { |
|
16423 map[ i ] = ( map[ i ] || [] ).concat( effects[ i ] ); |
|
16424 } |
|
16425 } |
|
16426 } |
|
16427 |
|
16428 function refx( effects ) { |
|
16429 var map = {}, |
|
16430 middleware; |
|
16431 |
|
16432 flattenIntoMap( map, effects ); |
|
16433 |
|
16434 middleware = function( store ) { |
|
16435 return function( next ) { |
|
16436 return function( action ) { |
|
16437 var handlers = map[ action.type ], |
|
16438 result = next( action ), |
|
16439 i, handlerAction; |
|
16440 |
|
16441 if ( handlers ) { |
|
16442 for ( i = 0; i < handlers.length; i++ ) { |
|
16443 handlerAction = handlers[ i ]( action, store ); |
|
16444 if ( handlerAction ) { |
|
16445 store.dispatch( handlerAction ); |
|
16446 } |
|
16447 } |
|
16448 } |
|
16449 |
|
16450 return result; |
|
16451 }; |
|
16452 }; |
|
16453 }; |
|
16454 |
|
16455 middleware.effects = map; |
|
16456 |
|
16457 return middleware; |
|
16458 } |
|
16459 |
|
16460 module.exports = refx; |
|
16461 |
|
16462 |
|
16463 /***/ }), |
|
16464 |
|
16465 /***/ 72: |
|
16466 /***/ (function(module, exports) { |
|
16467 |
|
16468 (function() { module.exports = this["wp"]["coreData"]; }()); |
|
16469 |
|
16470 /***/ }), |
|
16471 |
|
16472 /***/ 8: |
|
16473 /***/ (function(module, exports) { |
|
16474 |
|
16475 (function() { module.exports = this["wp"]["blockEditor"]; }()); |
|
16476 |
|
16477 /***/ }), |
|
16478 |
|
16479 /***/ 84: |
|
16480 /***/ (function(module, exports, __webpack_require__) { |
|
16481 |
|
16482 "use strict"; |
|
16483 // Copyright Joyent, Inc. and other Node contributors. |
|
16484 // |
|
16485 // Permission is hereby granted, free of charge, to any person obtaining a |
|
16486 // copy of this software and associated documentation files (the |
|
16487 // "Software"), to deal in the Software without restriction, including |
|
16488 // without limitation the rights to use, copy, modify, merge, publish, |
|
16489 // distribute, sublicense, and/or sell copies of the Software, and to permit |
|
16490 // persons to whom the Software is furnished to do so, subject to the |
|
16491 // following conditions: |
|
16492 // |
|
16493 // The above copyright notice and this permission notice shall be included |
|
16494 // in all copies or substantial portions of the Software. |
|
16495 // |
|
16496 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
16497 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
16498 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN |
|
16499 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
16500 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
16501 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|
16502 // USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
16503 |
|
16504 |
|
16505 |
|
16506 var punycode = __webpack_require__(117); |
|
16507 var util = __webpack_require__(119); |
|
16508 |
|
16509 exports.parse = urlParse; |
|
16510 exports.resolve = urlResolve; |
|
16511 exports.resolveObject = urlResolveObject; |
|
16512 exports.format = urlFormat; |
|
16513 |
|
16514 exports.Url = Url; |
|
16515 |
|
16516 function Url() { |
|
16517 this.protocol = null; |
|
16518 this.slashes = null; |
|
16519 this.auth = null; |
|
16520 this.host = null; |
|
16521 this.port = null; |
|
16522 this.hostname = null; |
|
16523 this.hash = null; |
|
16524 this.search = null; |
|
16525 this.query = null; |
|
16526 this.pathname = null; |
|
16527 this.path = null; |
|
16528 this.href = null; |
|
16529 } |
|
16530 |
|
16531 // Reference: RFC 3986, RFC 1808, RFC 2396 |
|
16532 |
|
16533 // define these here so at least they only have to be |
|
16534 // compiled once on the first module load. |
|
16535 var protocolPattern = /^([a-z0-9.+-]+:)/i, |
|
16536 portPattern = /:[0-9]*$/, |
|
16537 |
|
16538 // Special case for a simple path URL |
|
16539 simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, |
|
16540 |
|
16541 // RFC 2396: characters reserved for delimiting URLs. |
|
16542 // We actually just auto-escape these. |
|
16543 delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], |
|
16544 |
|
16545 // RFC 2396: characters not allowed for various reasons. |
|
16546 unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), |
|
16547 |
|
16548 // Allowed by RFCs, but cause of XSS attacks. Always escape these. |
|
16549 autoEscape = ['\''].concat(unwise), |
|
16550 // Characters that are never ever allowed in a hostname. |
|
16551 // Note that any invalid chars are also handled, but these |
|
16552 // are the ones that are *expected* to be seen, so we fast-path |
|
16553 // them. |
|
16554 nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), |
|
16555 hostEndingChars = ['/', '?', '#'], |
|
16556 hostnameMaxLen = 255, |
|
16557 hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, |
|
16558 hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, |
|
16559 // protocols that can allow "unsafe" and "unwise" chars. |
|
16560 unsafeProtocol = { |
|
16561 'javascript': true, |
|
16562 'javascript:': true |
|
16563 }, |
|
16564 // protocols that never have a hostname. |
|
16565 hostlessProtocol = { |
|
16566 'javascript': true, |
|
16567 'javascript:': true |
|
16568 }, |
|
16569 // protocols that always contain a // bit. |
|
16570 slashedProtocol = { |
|
16571 'http': true, |
|
16572 'https': true, |
|
16573 'ftp': true, |
|
16574 'gopher': true, |
|
16575 'file': true, |
|
16576 'http:': true, |
|
16577 'https:': true, |
|
16578 'ftp:': true, |
|
16579 'gopher:': true, |
|
16580 'file:': true |
|
16581 }, |
|
16582 querystring = __webpack_require__(120); |
|
16583 |
|
16584 function urlParse(url, parseQueryString, slashesDenoteHost) { |
|
16585 if (url && util.isObject(url) && url instanceof Url) return url; |
|
16586 |
|
16587 var u = new Url; |
|
16588 u.parse(url, parseQueryString, slashesDenoteHost); |
|
16589 return u; |
|
16590 } |
|
16591 |
|
16592 Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { |
|
16593 if (!util.isString(url)) { |
|
16594 throw new TypeError("Parameter 'url' must be a string, not " + typeof url); |
|
16595 } |
|
16596 |
|
16597 // Copy chrome, IE, opera backslash-handling behavior. |
|
16598 // Back slashes before the query string get converted to forward slashes |
|
16599 // See: https://code.google.com/p/chromium/issues/detail?id=25916 |
|
16600 var queryIndex = url.indexOf('?'), |
|
16601 splitter = |
|
16602 (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', |
|
16603 uSplit = url.split(splitter), |
|
16604 slashRegex = /\\/g; |
|
16605 uSplit[0] = uSplit[0].replace(slashRegex, '/'); |
|
16606 url = uSplit.join(splitter); |
|
16607 |
|
16608 var rest = url; |
|
16609 |
|
16610 // trim before proceeding. |
|
16611 // This is to support parse stuff like " http://foo.com \n" |
|
16612 rest = rest.trim(); |
|
16613 |
|
16614 if (!slashesDenoteHost && url.split('#').length === 1) { |
|
16615 // Try fast path regexp |
|
16616 var simplePath = simplePathPattern.exec(rest); |
|
16617 if (simplePath) { |
|
16618 this.path = rest; |
|
16619 this.href = rest; |
|
16620 this.pathname = simplePath[1]; |
|
16621 if (simplePath[2]) { |
|
16622 this.search = simplePath[2]; |
|
16623 if (parseQueryString) { |
|
16624 this.query = querystring.parse(this.search.substr(1)); |
|
16625 } else { |
|
16626 this.query = this.search.substr(1); |
|
16627 } |
|
16628 } else if (parseQueryString) { |
|
16629 this.search = ''; |
|
16630 this.query = {}; |
|
16631 } |
|
16632 return this; |
|
16633 } |
|
16634 } |
|
16635 |
|
16636 var proto = protocolPattern.exec(rest); |
|
16637 if (proto) { |
|
16638 proto = proto[0]; |
|
16639 var lowerProto = proto.toLowerCase(); |
|
16640 this.protocol = lowerProto; |
|
16641 rest = rest.substr(proto.length); |
|
16642 } |
|
16643 |
|
16644 // figure out if it's got a host |
|
16645 // user@server is *always* interpreted as a hostname, and url |
|
16646 // resolution will treat //foo/bar as host=foo,path=bar because that's |
|
16647 // how the browser resolves relative URLs. |
|
16648 if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { |
|
16649 var slashes = rest.substr(0, 2) === '//'; |
|
16650 if (slashes && !(proto && hostlessProtocol[proto])) { |
|
16651 rest = rest.substr(2); |
|
16652 this.slashes = true; |
|
16653 } |
|
16654 } |
|
16655 |
|
16656 if (!hostlessProtocol[proto] && |
|
16657 (slashes || (proto && !slashedProtocol[proto]))) { |
|
16658 |
|
16659 // there's a hostname. |
|
16660 // the first instance of /, ?, ;, or # ends the host. |
|
16661 // |
|
16662 // If there is an @ in the hostname, then non-host chars *are* allowed |
|
16663 // to the left of the last @ sign, unless some host-ending character |
|
16664 // comes *before* the @-sign. |
|
16665 // URLs are obnoxious. |
|
16666 // |
|
16667 // ex: |
|
16668 // http://a@b@c/ => user:a@b host:c |
|
16669 // http://a@b?@c => user:a host:c path:/?@c |
|
16670 |
|
16671 // v0.12 TODO(isaacs): This is not quite how Chrome does things. |
|
16672 // Review our test case against browsers more comprehensively. |
|
16673 |
|
16674 // find the first instance of any hostEndingChars |
|
16675 var hostEnd = -1; |
|
16676 for (var i = 0; i < hostEndingChars.length; i++) { |
|
16677 var hec = rest.indexOf(hostEndingChars[i]); |
|
16678 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) |
|
16679 hostEnd = hec; |
|
16680 } |
|
16681 |
|
16682 // at this point, either we have an explicit point where the |
|
16683 // auth portion cannot go past, or the last @ char is the decider. |
|
16684 var auth, atSign; |
|
16685 if (hostEnd === -1) { |
|
16686 // atSign can be anywhere. |
|
16687 atSign = rest.lastIndexOf('@'); |
|
16688 } else { |
|
16689 // atSign must be in auth portion. |
|
16690 // http://a@b/c@d => host:b auth:a path:/c@d |
|
16691 atSign = rest.lastIndexOf('@', hostEnd); |
|
16692 } |
|
16693 |
|
16694 // Now we have a portion which is definitely the auth. |
|
16695 // Pull that off. |
|
16696 if (atSign !== -1) { |
|
16697 auth = rest.slice(0, atSign); |
|
16698 rest = rest.slice(atSign + 1); |
|
16699 this.auth = decodeURIComponent(auth); |
|
16700 } |
|
16701 |
|
16702 // the host is the remaining to the left of the first non-host char |
|
16703 hostEnd = -1; |
|
16704 for (var i = 0; i < nonHostChars.length; i++) { |
|
16705 var hec = rest.indexOf(nonHostChars[i]); |
|
16706 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) |
|
16707 hostEnd = hec; |
|
16708 } |
|
16709 // if we still have not hit it, then the entire thing is a host. |
|
16710 if (hostEnd === -1) |
|
16711 hostEnd = rest.length; |
|
16712 |
|
16713 this.host = rest.slice(0, hostEnd); |
|
16714 rest = rest.slice(hostEnd); |
|
16715 |
|
16716 // pull out port. |
|
16717 this.parseHost(); |
|
16718 |
|
16719 // we've indicated that there is a hostname, |
|
16720 // so even if it's empty, it has to be present. |
|
16721 this.hostname = this.hostname || ''; |
|
16722 |
|
16723 // if hostname begins with [ and ends with ] |
|
16724 // assume that it's an IPv6 address. |
|
16725 var ipv6Hostname = this.hostname[0] === '[' && |
|
16726 this.hostname[this.hostname.length - 1] === ']'; |
|
16727 |
|
16728 // validate a little. |
|
16729 if (!ipv6Hostname) { |
|
16730 var hostparts = this.hostname.split(/\./); |
|
16731 for (var i = 0, l = hostparts.length; i < l; i++) { |
|
16732 var part = hostparts[i]; |
|
16733 if (!part) continue; |
|
16734 if (!part.match(hostnamePartPattern)) { |
|
16735 var newpart = ''; |
|
16736 for (var j = 0, k = part.length; j < k; j++) { |
|
16737 if (part.charCodeAt(j) > 127) { |
|
16738 // we replace non-ASCII char with a temporary placeholder |
|
16739 // we need this to make sure size of hostname is not |
|
16740 // broken by replacing non-ASCII by nothing |
|
16741 newpart += 'x'; |
|
16742 } else { |
|
16743 newpart += part[j]; |
|
16744 } |
|
16745 } |
|
16746 // we test again with ASCII char only |
|
16747 if (!newpart.match(hostnamePartPattern)) { |
|
16748 var validParts = hostparts.slice(0, i); |
|
16749 var notHost = hostparts.slice(i + 1); |
|
16750 var bit = part.match(hostnamePartStart); |
|
16751 if (bit) { |
|
16752 validParts.push(bit[1]); |
|
16753 notHost.unshift(bit[2]); |
|
16754 } |
|
16755 if (notHost.length) { |
|
16756 rest = '/' + notHost.join('.') + rest; |
|
16757 } |
|
16758 this.hostname = validParts.join('.'); |
|
16759 break; |
|
16760 } |
|
16761 } |
|
16762 } |
|
16763 } |
|
16764 |
|
16765 if (this.hostname.length > hostnameMaxLen) { |
|
16766 this.hostname = ''; |
|
16767 } else { |
|
16768 // hostnames are always lower case. |
|
16769 this.hostname = this.hostname.toLowerCase(); |
|
16770 } |
|
16771 |
|
16772 if (!ipv6Hostname) { |
|
16773 // IDNA Support: Returns a punycoded representation of "domain". |
|
16774 // It only converts parts of the domain name that |
|
16775 // have non-ASCII characters, i.e. it doesn't matter if |
|
16776 // you call it with a domain that already is ASCII-only. |
|
16777 this.hostname = punycode.toASCII(this.hostname); |
|
16778 } |
|
16779 |
|
16780 var p = this.port ? ':' + this.port : ''; |
|
16781 var h = this.hostname || ''; |
|
16782 this.host = h + p; |
|
16783 this.href += this.host; |
|
16784 |
|
16785 // strip [ and ] from the hostname |
|
16786 // the host field still retains them, though |
|
16787 if (ipv6Hostname) { |
|
16788 this.hostname = this.hostname.substr(1, this.hostname.length - 2); |
|
16789 if (rest[0] !== '/') { |
|
16790 rest = '/' + rest; |
|
16791 } |
|
16792 } |
|
16793 } |
|
16794 |
|
16795 // now rest is set to the post-host stuff. |
|
16796 // chop off any delim chars. |
|
16797 if (!unsafeProtocol[lowerProto]) { |
|
16798 |
|
16799 // First, make 100% sure that any "autoEscape" chars get |
|
16800 // escaped, even if encodeURIComponent doesn't think they |
|
16801 // need to be. |
|
16802 for (var i = 0, l = autoEscape.length; i < l; i++) { |
|
16803 var ae = autoEscape[i]; |
|
16804 if (rest.indexOf(ae) === -1) |
|
16805 continue; |
|
16806 var esc = encodeURIComponent(ae); |
|
16807 if (esc === ae) { |
|
16808 esc = escape(ae); |
|
16809 } |
|
16810 rest = rest.split(ae).join(esc); |
|
16811 } |
|
16812 } |
|
16813 |
|
16814 |
|
16815 // chop off from the tail first. |
|
16816 var hash = rest.indexOf('#'); |
|
16817 if (hash !== -1) { |
|
16818 // got a fragment string. |
|
16819 this.hash = rest.substr(hash); |
|
16820 rest = rest.slice(0, hash); |
|
16821 } |
|
16822 var qm = rest.indexOf('?'); |
|
16823 if (qm !== -1) { |
|
16824 this.search = rest.substr(qm); |
|
16825 this.query = rest.substr(qm + 1); |
|
16826 if (parseQueryString) { |
|
16827 this.query = querystring.parse(this.query); |
|
16828 } |
|
16829 rest = rest.slice(0, qm); |
|
16830 } else if (parseQueryString) { |
|
16831 // no query string, but parseQueryString still requested |
|
16832 this.search = ''; |
|
16833 this.query = {}; |
|
16834 } |
|
16835 if (rest) this.pathname = rest; |
|
16836 if (slashedProtocol[lowerProto] && |
|
16837 this.hostname && !this.pathname) { |
|
16838 this.pathname = '/'; |
|
16839 } |
|
16840 |
|
16841 //to support http.request |
|
16842 if (this.pathname || this.search) { |
|
16843 var p = this.pathname || ''; |
|
16844 var s = this.search || ''; |
|
16845 this.path = p + s; |
|
16846 } |
|
16847 |
|
16848 // finally, reconstruct the href based on what has been validated. |
|
16849 this.href = this.format(); |
|
16850 return this; |
|
16851 }; |
|
16852 |
|
16853 // format a parsed object into a url string |
|
16854 function urlFormat(obj) { |
|
16855 // ensure it's an object, and not a string url. |
|
16856 // If it's an obj, this is a no-op. |
|
16857 // this way, you can call url_format() on strings |
|
16858 // to clean up potentially wonky urls. |
|
16859 if (util.isString(obj)) obj = urlParse(obj); |
|
16860 if (!(obj instanceof Url)) return Url.prototype.format.call(obj); |
|
16861 return obj.format(); |
|
16862 } |
|
16863 |
|
16864 Url.prototype.format = function() { |
|
16865 var auth = this.auth || ''; |
|
16866 if (auth) { |
|
16867 auth = encodeURIComponent(auth); |
|
16868 auth = auth.replace(/%3A/i, ':'); |
|
16869 auth += '@'; |
|
16870 } |
|
16871 |
|
16872 var protocol = this.protocol || '', |
|
16873 pathname = this.pathname || '', |
|
16874 hash = this.hash || '', |
|
16875 host = false, |
|
16876 query = ''; |
|
16877 |
|
16878 if (this.host) { |
|
16879 host = auth + this.host; |
|
16880 } else if (this.hostname) { |
|
16881 host = auth + (this.hostname.indexOf(':') === -1 ? |
|
16882 this.hostname : |
|
16883 '[' + this.hostname + ']'); |
|
16884 if (this.port) { |
|
16885 host += ':' + this.port; |
|
16886 } |
|
16887 } |
|
16888 |
|
16889 if (this.query && |
|
16890 util.isObject(this.query) && |
|
16891 Object.keys(this.query).length) { |
|
16892 query = querystring.stringify(this.query); |
|
16893 } |
|
16894 |
|
16895 var search = this.search || (query && ('?' + query)) || ''; |
|
16896 |
|
16897 if (protocol && protocol.substr(-1) !== ':') protocol += ':'; |
|
16898 |
|
16899 // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. |
|
16900 // unless they had them to begin with. |
|
16901 if (this.slashes || |
|
16902 (!protocol || slashedProtocol[protocol]) && host !== false) { |
|
16903 host = '//' + (host || ''); |
|
16904 if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; |
|
16905 } else if (!host) { |
|
16906 host = ''; |
|
16907 } |
|
16908 |
|
16909 if (hash && hash.charAt(0) !== '#') hash = '#' + hash; |
|
16910 if (search && search.charAt(0) !== '?') search = '?' + search; |
|
16911 |
|
16912 pathname = pathname.replace(/[?#]/g, function(match) { |
|
16913 return encodeURIComponent(match); |
|
16914 }); |
|
16915 search = search.replace('#', '%23'); |
|
16916 |
|
16917 return protocol + host + pathname + search + hash; |
|
16918 }; |
|
16919 |
|
16920 function urlResolve(source, relative) { |
|
16921 return urlParse(source, false, true).resolve(relative); |
|
16922 } |
|
16923 |
|
16924 Url.prototype.resolve = function(relative) { |
|
16925 return this.resolveObject(urlParse(relative, false, true)).format(); |
|
16926 }; |
|
16927 |
|
16928 function urlResolveObject(source, relative) { |
|
16929 if (!source) return relative; |
|
16930 return urlParse(source, false, true).resolveObject(relative); |
|
16931 } |
|
16932 |
|
16933 Url.prototype.resolveObject = function(relative) { |
|
16934 if (util.isString(relative)) { |
|
16935 var rel = new Url(); |
|
16936 rel.parse(relative, false, true); |
|
16937 relative = rel; |
|
16938 } |
|
16939 |
|
16940 var result = new Url(); |
|
16941 var tkeys = Object.keys(this); |
|
16942 for (var tk = 0; tk < tkeys.length; tk++) { |
|
16943 var tkey = tkeys[tk]; |
|
16944 result[tkey] = this[tkey]; |
|
16945 } |
|
16946 |
|
16947 // hash is always overridden, no matter what. |
|
16948 // even href="" will remove it. |
|
16949 result.hash = relative.hash; |
|
16950 |
|
16951 // if the relative url is empty, then there's nothing left to do here. |
|
16952 if (relative.href === '') { |
|
16953 result.href = result.format(); |
|
16954 return result; |
|
16955 } |
|
16956 |
|
16957 // hrefs like //foo/bar always cut to the protocol. |
|
16958 if (relative.slashes && !relative.protocol) { |
|
16959 // take everything except the protocol from relative |
|
16960 var rkeys = Object.keys(relative); |
|
16961 for (var rk = 0; rk < rkeys.length; rk++) { |
|
16962 var rkey = rkeys[rk]; |
|
16963 if (rkey !== 'protocol') |
|
16964 result[rkey] = relative[rkey]; |
|
16965 } |
|
16966 |
|
16967 //urlParse appends trailing / to urls like http://www.example.com |
|
16968 if (slashedProtocol[result.protocol] && |
|
16969 result.hostname && !result.pathname) { |
|
16970 result.path = result.pathname = '/'; |
|
16971 } |
|
16972 |
|
16973 result.href = result.format(); |
|
16974 return result; |
|
16975 } |
|
16976 |
|
16977 if (relative.protocol && relative.protocol !== result.protocol) { |
|
16978 // if it's a known url protocol, then changing |
|
16979 // the protocol does weird things |
|
16980 // first, if it's not file:, then we MUST have a host, |
|
16981 // and if there was a path |
|
16982 // to begin with, then we MUST have a path. |
|
16983 // if it is file:, then the host is dropped, |
|
16984 // because that's known to be hostless. |
|
16985 // anything else is assumed to be absolute. |
|
16986 if (!slashedProtocol[relative.protocol]) { |
|
16987 var keys = Object.keys(relative); |
|
16988 for (var v = 0; v < keys.length; v++) { |
|
16989 var k = keys[v]; |
|
16990 result[k] = relative[k]; |
|
16991 } |
|
16992 result.href = result.format(); |
|
16993 return result; |
|
16994 } |
|
16995 |
|
16996 result.protocol = relative.protocol; |
|
16997 if (!relative.host && !hostlessProtocol[relative.protocol]) { |
|
16998 var relPath = (relative.pathname || '').split('/'); |
|
16999 while (relPath.length && !(relative.host = relPath.shift())); |
|
17000 if (!relative.host) relative.host = ''; |
|
17001 if (!relative.hostname) relative.hostname = ''; |
|
17002 if (relPath[0] !== '') relPath.unshift(''); |
|
17003 if (relPath.length < 2) relPath.unshift(''); |
|
17004 result.pathname = relPath.join('/'); |
|
17005 } else { |
|
17006 result.pathname = relative.pathname; |
|
17007 } |
|
17008 result.search = relative.search; |
|
17009 result.query = relative.query; |
|
17010 result.host = relative.host || ''; |
|
17011 result.auth = relative.auth; |
|
17012 result.hostname = relative.hostname || relative.host; |
|
17013 result.port = relative.port; |
|
17014 // to support http.request |
|
17015 if (result.pathname || result.search) { |
|
17016 var p = result.pathname || ''; |
|
17017 var s = result.search || ''; |
|
17018 result.path = p + s; |
|
17019 } |
|
17020 result.slashes = result.slashes || relative.slashes; |
|
17021 result.href = result.format(); |
|
17022 return result; |
|
17023 } |
|
17024 |
|
17025 var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), |
|
17026 isRelAbs = ( |
|
17027 relative.host || |
|
17028 relative.pathname && relative.pathname.charAt(0) === '/' |
|
17029 ), |
|
17030 mustEndAbs = (isRelAbs || isSourceAbs || |
|
17031 (result.host && relative.pathname)), |
|
17032 removeAllDots = mustEndAbs, |
|
17033 srcPath = result.pathname && result.pathname.split('/') || [], |
|
17034 relPath = relative.pathname && relative.pathname.split('/') || [], |
|
17035 psychotic = result.protocol && !slashedProtocol[result.protocol]; |
|
17036 |
|
17037 // if the url is a non-slashed url, then relative |
|
17038 // links like ../.. should be able |
|
17039 // to crawl up to the hostname, as well. This is strange. |
|
17040 // result.protocol has already been set by now. |
|
17041 // Later on, put the first path part into the host field. |
|
17042 if (psychotic) { |
|
17043 result.hostname = ''; |
|
17044 result.port = null; |
|
17045 if (result.host) { |
|
17046 if (srcPath[0] === '') srcPath[0] = result.host; |
|
17047 else srcPath.unshift(result.host); |
|
17048 } |
|
17049 result.host = ''; |
|
17050 if (relative.protocol) { |
|
17051 relative.hostname = null; |
|
17052 relative.port = null; |
|
17053 if (relative.host) { |
|
17054 if (relPath[0] === '') relPath[0] = relative.host; |
|
17055 else relPath.unshift(relative.host); |
|
17056 } |
|
17057 relative.host = null; |
|
17058 } |
|
17059 mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); |
|
17060 } |
|
17061 |
|
17062 if (isRelAbs) { |
|
17063 // it's absolute. |
|
17064 result.host = (relative.host || relative.host === '') ? |
|
17065 relative.host : result.host; |
|
17066 result.hostname = (relative.hostname || relative.hostname === '') ? |
|
17067 relative.hostname : result.hostname; |
|
17068 result.search = relative.search; |
|
17069 result.query = relative.query; |
|
17070 srcPath = relPath; |
|
17071 // fall through to the dot-handling below. |
|
17072 } else if (relPath.length) { |
|
17073 // it's relative |
|
17074 // throw away the existing file, and take the new path instead. |
|
17075 if (!srcPath) srcPath = []; |
|
17076 srcPath.pop(); |
|
17077 srcPath = srcPath.concat(relPath); |
|
17078 result.search = relative.search; |
|
17079 result.query = relative.query; |
|
17080 } else if (!util.isNullOrUndefined(relative.search)) { |
|
17081 // just pull out the search. |
|
17082 // like href='?foo'. |
|
17083 // Put this after the other two cases because it simplifies the booleans |
|
17084 if (psychotic) { |
|
17085 result.hostname = result.host = srcPath.shift(); |
|
17086 //occationaly the auth can get stuck only in host |
|
17087 //this especially happens in cases like |
|
17088 //url.resolveObject('mailto:local1@domain1', 'local2@domain2') |
|
17089 var authInHost = result.host && result.host.indexOf('@') > 0 ? |
|
17090 result.host.split('@') : false; |
|
17091 if (authInHost) { |
|
17092 result.auth = authInHost.shift(); |
|
17093 result.host = result.hostname = authInHost.shift(); |
|
17094 } |
|
17095 } |
|
17096 result.search = relative.search; |
|
17097 result.query = relative.query; |
|
17098 //to support http.request |
|
17099 if (!util.isNull(result.pathname) || !util.isNull(result.search)) { |
|
17100 result.path = (result.pathname ? result.pathname : '') + |
|
17101 (result.search ? result.search : ''); |
|
17102 } |
|
17103 result.href = result.format(); |
|
17104 return result; |
|
17105 } |
|
17106 |
|
17107 if (!srcPath.length) { |
|
17108 // no path at all. easy. |
|
17109 // we've already handled the other stuff above. |
|
17110 result.pathname = null; |
|
17111 //to support http.request |
|
17112 if (result.search) { |
|
17113 result.path = '/' + result.search; |
|
17114 } else { |
|
17115 result.path = null; |
|
17116 } |
|
17117 result.href = result.format(); |
|
17118 return result; |
|
17119 } |
|
17120 |
|
17121 // if a url ENDs in . or .., then it must get a trailing slash. |
|
17122 // however, if it ends in anything else non-slashy, |
|
17123 // then it must NOT get a trailing slash. |
|
17124 var last = srcPath.slice(-1)[0]; |
|
17125 var hasTrailingSlash = ( |
|
17126 (result.host || relative.host || srcPath.length > 1) && |
|
17127 (last === '.' || last === '..') || last === ''); |
|
17128 |
|
17129 // strip single dots, resolve double dots to parent dir |
|
17130 // if the path tries to go above the root, `up` ends up > 0 |
|
17131 var up = 0; |
|
17132 for (var i = srcPath.length; i >= 0; i--) { |
|
17133 last = srcPath[i]; |
|
17134 if (last === '.') { |
|
17135 srcPath.splice(i, 1); |
|
17136 } else if (last === '..') { |
|
17137 srcPath.splice(i, 1); |
|
17138 up++; |
|
17139 } else if (up) { |
|
17140 srcPath.splice(i, 1); |
|
17141 up--; |
|
17142 } |
|
17143 } |
|
17144 |
|
17145 // if the path is allowed to go above the root, restore leading ..s |
|
17146 if (!mustEndAbs && !removeAllDots) { |
|
17147 for (; up--; up) { |
|
17148 srcPath.unshift('..'); |
|
17149 } |
|
17150 } |
|
17151 |
|
17152 if (mustEndAbs && srcPath[0] !== '' && |
|
17153 (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { |
|
17154 srcPath.unshift(''); |
|
17155 } |
|
17156 |
|
17157 if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { |
|
17158 srcPath.push(''); |
|
17159 } |
|
17160 |
|
17161 var isAbsolute = srcPath[0] === '' || |
|
17162 (srcPath[0] && srcPath[0].charAt(0) === '/'); |
|
17163 |
|
17164 // put the host back |
|
17165 if (psychotic) { |
|
17166 result.hostname = result.host = isAbsolute ? '' : |
|
17167 srcPath.length ? srcPath.shift() : ''; |
|
17168 //occationaly the auth can get stuck only in host |
|
17169 //this especially happens in cases like |
|
17170 //url.resolveObject('mailto:local1@domain1', 'local2@domain2') |
|
17171 var authInHost = result.host && result.host.indexOf('@') > 0 ? |
|
17172 result.host.split('@') : false; |
|
17173 if (authInHost) { |
|
17174 result.auth = authInHost.shift(); |
|
17175 result.host = result.hostname = authInHost.shift(); |
|
17176 } |
|
17177 } |
|
17178 |
|
17179 mustEndAbs = mustEndAbs || (result.host && srcPath.length); |
|
17180 |
|
17181 if (mustEndAbs && !isAbsolute) { |
|
17182 srcPath.unshift(''); |
|
17183 } |
|
17184 |
|
17185 if (!srcPath.length) { |
|
17186 result.pathname = null; |
|
17187 result.path = null; |
|
17188 } else { |
|
17189 result.pathname = srcPath.join('/'); |
|
17190 } |
|
17191 |
|
17192 //to support request.http |
|
17193 if (!util.isNull(result.pathname) || !util.isNull(result.search)) { |
|
17194 result.path = (result.pathname ? result.pathname : '') + |
|
17195 (result.search ? result.search : ''); |
|
17196 } |
|
17197 result.auth = relative.auth || result.auth; |
|
17198 result.slashes = result.slashes || relative.slashes; |
|
17199 result.href = result.format(); |
|
17200 return result; |
|
17201 }; |
|
17202 |
|
17203 Url.prototype.parseHost = function() { |
|
17204 var host = this.host; |
|
17205 var port = portPattern.exec(host); |
|
17206 if (port) { |
|
17207 port = port[0]; |
|
17208 if (port !== ':') { |
|
17209 this.port = port.substr(1); |
|
17210 } |
|
17211 host = host.substr(0, host.length - port.length); |
|
17212 } |
|
17213 if (host) this.hostname = host; |
|
17214 }; |
|
17215 |
|
17216 |
|
17217 /***/ }), |
|
17218 |
|
17219 /***/ 89: |
|
17220 /***/ (function(module, exports, __webpack_require__) { |
|
17221 |
|
17222 "use strict"; |
|
17223 /** |
|
17224 * Copyright (c) 2013-present, Facebook, Inc. |
|
17225 * |
|
17226 * This source code is licensed under the MIT license found in the |
|
17227 * LICENSE file in the root directory of this source tree. |
|
17228 */ |
|
17229 |
|
17230 |
|
17231 |
|
17232 var ReactPropTypesSecret = __webpack_require__(90); |
|
17233 |
|
17234 function emptyFunction() {} |
|
17235 |
|
17236 module.exports = function() { |
|
17237 function shim(props, propName, componentName, location, propFullName, secret) { |
|
17238 if (secret === ReactPropTypesSecret) { |
|
17239 // It is still safe when called from React. |
|
17240 return; |
|
17241 } |
|
17242 var err = new Error( |
|
17243 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + |
|
17244 'Use PropTypes.checkPropTypes() to call them. ' + |
|
17245 'Read more at http://fb.me/use-check-prop-types' |
|
17246 ); |
|
17247 err.name = 'Invariant Violation'; |
|
17248 throw err; |
|
17249 }; |
|
17250 shim.isRequired = shim; |
|
17251 function getShim() { |
|
17252 return shim; |
|
17253 }; |
|
17254 // Important! |
|
17255 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. |
|
17256 var ReactPropTypes = { |
|
17257 array: shim, |
|
17258 bool: shim, |
|
17259 func: shim, |
|
17260 number: shim, |
|
17261 object: shim, |
|
17262 string: shim, |
|
17263 symbol: shim, |
|
17264 |
|
17265 any: shim, |
|
17266 arrayOf: getShim, |
|
17267 element: shim, |
|
17268 instanceOf: getShim, |
|
17269 node: shim, |
|
17270 objectOf: getShim, |
|
17271 oneOf: getShim, |
|
17272 oneOfType: getShim, |
|
17273 shape: getShim, |
|
17274 exact: getShim |
|
17275 }; |
|
17276 |
|
17277 ReactPropTypes.checkPropTypes = emptyFunction; |
|
17278 ReactPropTypes.PropTypes = ReactPropTypes; |
|
17279 |
|
17280 return ReactPropTypes; |
|
17281 }; |
|
17282 |
|
17283 |
|
17284 /***/ }), |
|
17285 |
|
17286 /***/ 9: |
|
17287 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
17288 |
|
17289 "use strict"; |
|
17290 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); |
|
17291 function _defineProperties(target, props) { |
|
17292 for (var i = 0; i < props.length; i++) { |
|
17293 var descriptor = props[i]; |
|
17294 descriptor.enumerable = descriptor.enumerable || false; |
|
17295 descriptor.configurable = true; |
|
17296 if ("value" in descriptor) descriptor.writable = true; |
|
17297 Object.defineProperty(target, descriptor.key, descriptor); |
|
17298 } |
|
17299 } |
|
17300 |
|
17301 function _createClass(Constructor, protoProps, staticProps) { |
|
17302 if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
17303 if (staticProps) _defineProperties(Constructor, staticProps); |
|
17304 return Constructor; |
|
17305 } |
|
17306 |
|
17307 /***/ }), |
|
17308 |
|
17309 /***/ 90: |
|
17310 /***/ (function(module, exports, __webpack_require__) { |
|
17311 |
|
17312 "use strict"; |
|
17313 /** |
|
17314 * Copyright (c) 2013-present, Facebook, Inc. |
|
17315 * |
|
17316 * This source code is licensed under the MIT license found in the |
|
17317 * LICENSE file in the root directory of this source tree. |
|
17318 */ |
|
17319 |
|
17320 |
|
17321 |
|
17322 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
|
17323 |
|
17324 module.exports = ReactPropTypesSecret; |
|
17325 |
|
17326 |
14478 |
17327 /***/ }), |
14479 /***/ }), |
17328 |
14480 |
17329 /***/ 97: |
14481 /***/ 97: |
17330 /***/ (function(module, exports, __webpack_require__) { |
14482 /***/ (function(module, exports, __webpack_require__) { |
17331 |
14483 |
17332 "use strict"; |
14484 "use strict"; |
17333 |
14485 |
17334 |
14486 exports.__esModule = true; |
17335 Object.defineProperty(exports, "__esModule", { |
14487 var TextareaAutosize_1 = __webpack_require__(173); |
17336 value: true |
14488 exports["default"] = TextareaAutosize_1["default"]; |
17337 }); |
14489 |
17338 /** |
|
17339 * Redux dispatch multiple actions |
|
17340 */ |
|
17341 |
|
17342 function multi(_ref) { |
|
17343 var dispatch = _ref.dispatch; |
|
17344 |
|
17345 return function (next) { |
|
17346 return function (action) { |
|
17347 return Array.isArray(action) ? action.filter(Boolean).map(dispatch) : next(action); |
|
17348 }; |
|
17349 }; |
|
17350 } |
|
17351 |
|
17352 /** |
|
17353 * Exports |
|
17354 */ |
|
17355 |
|
17356 exports.default = multi; |
|
17357 |
14490 |
17358 /***/ }), |
14491 /***/ }), |
17359 |
14492 |
17360 /***/ 98: |
14493 /***/ 98: |
17361 /***/ (function(module, exports) { |
14494 /***/ (function(module, exports) { |
17362 |
14495 |
17363 (function() { module.exports = this["wp"]["wordcount"]; }()); |
14496 (function() { module.exports = this["wp"]["coreData"]; }()); |
17364 |
14497 |
17365 /***/ }) |
14498 /***/ }) |
17366 |
14499 |
17367 /******/ }); |
14500 /******/ }); |