editor.js (393053B)
1 this["wp"] = this["wp"] || {}; this["wp"]["editor"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = "PLxR"); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ({ 89 90 /***/ "16Al": 91 /***/ (function(module, exports, __webpack_require__) { 92 93 "use strict"; 94 /** 95 * Copyright (c) 2013-present, Facebook, Inc. 96 * 97 * This source code is licensed under the MIT license found in the 98 * LICENSE file in the root directory of this source tree. 99 */ 100 101 102 103 var ReactPropTypesSecret = __webpack_require__("WbBG"); 104 105 function emptyFunction() {} 106 function emptyFunctionWithReset() {} 107 emptyFunctionWithReset.resetWarningCache = emptyFunction; 108 109 module.exports = function() { 110 function shim(props, propName, componentName, location, propFullName, secret) { 111 if (secret === ReactPropTypesSecret) { 112 // It is still safe when called from React. 113 return; 114 } 115 var err = new Error( 116 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 117 'Use PropTypes.checkPropTypes() to call them. ' + 118 'Read more at http://fb.me/use-check-prop-types' 119 ); 120 err.name = 'Invariant Violation'; 121 throw err; 122 }; 123 shim.isRequired = shim; 124 function getShim() { 125 return shim; 126 }; 127 // Important! 128 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 129 var ReactPropTypes = { 130 array: shim, 131 bool: shim, 132 func: shim, 133 number: shim, 134 object: shim, 135 string: shim, 136 symbol: shim, 137 138 any: shim, 139 arrayOf: getShim, 140 element: shim, 141 elementType: shim, 142 instanceOf: getShim, 143 node: shim, 144 objectOf: getShim, 145 oneOf: getShim, 146 oneOfType: getShim, 147 shape: getShim, 148 exact: getShim, 149 150 checkPropTypes: emptyFunctionWithReset, 151 resetWarningCache: emptyFunction 152 }; 153 154 ReactPropTypes.PropTypes = ReactPropTypes; 155 156 return ReactPropTypes; 157 }; 158 159 160 /***/ }), 161 162 /***/ "17x9": 163 /***/ (function(module, exports, __webpack_require__) { 164 165 /** 166 * Copyright (c) 2013-present, Facebook, Inc. 167 * 168 * This source code is licensed under the MIT license found in the 169 * LICENSE file in the root directory of this source tree. 170 */ 171 172 if (false) { var throwOnDirectAccess, ReactIs; } else { 173 // By explicitly using `prop-types` you are opting into new production behavior. 174 // http://fb.me/prop-types-in-prod 175 module.exports = __webpack_require__("16Al")(); 176 } 177 178 179 /***/ }), 180 181 /***/ "1ZqX": 182 /***/ (function(module, exports) { 183 184 (function() { module.exports = window["wp"]["data"]; }()); 185 186 /***/ }), 187 188 /***/ "51Zz": 189 /***/ (function(module, exports) { 190 191 (function() { module.exports = window["wp"]["dataControls"]; }()); 192 193 /***/ }), 194 195 /***/ "6aBm": 196 /***/ (function(module, exports) { 197 198 (function() { module.exports = window["wp"]["mediaUtils"]; }()); 199 200 /***/ }), 201 202 /***/ "7fqt": 203 /***/ (function(module, exports) { 204 205 (function() { module.exports = window["wp"]["wordcount"]; }()); 206 207 /***/ }), 208 209 /***/ "CNgt": 210 /***/ (function(module, exports, __webpack_require__) { 211 212 "use strict"; 213 214 var __extends = (this && this.__extends) || (function () { 215 var extendStatics = Object.setPrototypeOf || 216 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 217 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 218 return function (d, b) { 219 extendStatics(d, b); 220 function __() { this.constructor = d; } 221 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 222 }; 223 })(); 224 var __assign = (this && this.__assign) || Object.assign || function(t) { 225 for (var s, i = 1, n = arguments.length; i < n; i++) { 226 s = arguments[i]; 227 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 228 t[p] = s[p]; 229 } 230 return t; 231 }; 232 var __rest = (this && this.__rest) || function (s, e) { 233 var t = {}; 234 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 235 t[p] = s[p]; 236 if (s != null && typeof Object.getOwnPropertySymbols === "function") 237 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 238 t[p[i]] = s[p[i]]; 239 return t; 240 }; 241 exports.__esModule = true; 242 var React = __webpack_require__("cDcd"); 243 var PropTypes = __webpack_require__("17x9"); 244 var autosize = __webpack_require__("GemG"); 245 var _getLineHeight = __webpack_require__("Rk8H"); 246 var getLineHeight = _getLineHeight; 247 var RESIZED = "autosize:resized"; 248 /** 249 * A light replacement for built-in textarea component 250 * which automaticaly adjusts its height to match the content 251 */ 252 var TextareaAutosizeClass = /** @class */ (function (_super) { 253 __extends(TextareaAutosizeClass, _super); 254 function TextareaAutosizeClass() { 255 var _this = _super !== null && _super.apply(this, arguments) || this; 256 _this.state = { 257 lineHeight: null 258 }; 259 _this.textarea = null; 260 _this.onResize = function (e) { 261 if (_this.props.onResize) { 262 _this.props.onResize(e); 263 } 264 }; 265 _this.updateLineHeight = function () { 266 if (_this.textarea) { 267 _this.setState({ 268 lineHeight: getLineHeight(_this.textarea) 269 }); 270 } 271 }; 272 _this.onChange = function (e) { 273 var onChange = _this.props.onChange; 274 _this.currentValue = e.currentTarget.value; 275 onChange && onChange(e); 276 }; 277 return _this; 278 } 279 TextareaAutosizeClass.prototype.componentDidMount = function () { 280 var _this = this; 281 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 282 if (typeof maxRows === "number") { 283 this.updateLineHeight(); 284 } 285 if (typeof maxRows === "number" || async) { 286 /* 287 the defer is needed to: 288 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 289 - support StyledComponents (see #71) 290 */ 291 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 292 } 293 else { 294 this.textarea && autosize(this.textarea); 295 } 296 if (this.textarea) { 297 this.textarea.addEventListener(RESIZED, this.onResize); 298 } 299 }; 300 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 301 if (this.textarea) { 302 this.textarea.removeEventListener(RESIZED, this.onResize); 303 autosize.destroy(this.textarea); 304 } 305 }; 306 TextareaAutosizeClass.prototype.render = function () { 307 var _this = this; 308 var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; 309 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 310 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 311 _this.textarea = element; 312 if (typeof _this.props.innerRef === 'function') { 313 _this.props.innerRef(element); 314 } 315 else if (_this.props.innerRef) { 316 _this.props.innerRef.current = element; 317 } 318 } }), children)); 319 }; 320 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 321 this.textarea && autosize.update(this.textarea); 322 }; 323 TextareaAutosizeClass.defaultProps = { 324 rows: 1, 325 async: false 326 }; 327 TextareaAutosizeClass.propTypes = { 328 rows: PropTypes.number, 329 maxRows: PropTypes.number, 330 onResize: PropTypes.func, 331 innerRef: PropTypes.any, 332 async: PropTypes.bool 333 }; 334 return TextareaAutosizeClass; 335 }(React.Component)); 336 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 337 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 338 }); 339 340 341 /***/ }), 342 343 /***/ "Civd": 344 /***/ (function(module, __webpack_exports__, __webpack_require__) { 345 346 "use strict"; 347 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 348 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 349 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 350 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 351 352 353 /** 354 * WordPress dependencies 355 */ 356 357 const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 358 xmlns: "http://www.w3.org/2000/svg", 359 viewBox: "0 0 24 24" 360 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 361 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 362 })); 363 /* harmony default export */ __webpack_exports__["a"] = (layout); 364 365 366 /***/ }), 367 368 /***/ "FqII": 369 /***/ (function(module, exports) { 370 371 (function() { module.exports = window["wp"]["date"]; }()); 372 373 /***/ }), 374 375 /***/ "GRId": 376 /***/ (function(module, exports) { 377 378 (function() { module.exports = window["wp"]["element"]; }()); 379 380 /***/ }), 381 382 /***/ "GemG": 383 /***/ (function(module, exports, __webpack_require__) { 384 385 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 386 autosize 4.0.4 387 license: MIT 388 http://www.jacklmoore.com/autosize 389 */ 390 (function (global, factory) { 391 if (true) { 392 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 393 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 394 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 395 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 396 } else { var mod; } 397 })(this, function (module, exports) { 398 'use strict'; 399 400 var map = typeof Map === "function" ? new Map() : function () { 401 var keys = []; 402 var values = []; 403 404 return { 405 has: function has(key) { 406 return keys.indexOf(key) > -1; 407 }, 408 get: function get(key) { 409 return values[keys.indexOf(key)]; 410 }, 411 set: function set(key, value) { 412 if (keys.indexOf(key) === -1) { 413 keys.push(key); 414 values.push(value); 415 } 416 }, 417 delete: function _delete(key) { 418 var index = keys.indexOf(key); 419 if (index > -1) { 420 keys.splice(index, 1); 421 values.splice(index, 1); 422 } 423 } 424 }; 425 }(); 426 427 var createEvent = function createEvent(name) { 428 return new Event(name, { bubbles: true }); 429 }; 430 try { 431 new Event('test'); 432 } catch (e) { 433 // IE does not support `new Event()` 434 createEvent = function createEvent(name) { 435 var evt = document.createEvent('Event'); 436 evt.initEvent(name, true, false); 437 return evt; 438 }; 439 } 440 441 function assign(ta) { 442 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 443 444 var heightOffset = null; 445 var clientWidth = null; 446 var cachedHeight = null; 447 448 function init() { 449 var style = window.getComputedStyle(ta, null); 450 451 if (style.resize === 'vertical') { 452 ta.style.resize = 'none'; 453 } else if (style.resize === 'both') { 454 ta.style.resize = 'horizontal'; 455 } 456 457 if (style.boxSizing === 'content-box') { 458 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 459 } else { 460 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 461 } 462 // Fix when a textarea is not on document body and heightOffset is Not a Number 463 if (isNaN(heightOffset)) { 464 heightOffset = 0; 465 } 466 467 update(); 468 } 469 470 function changeOverflow(value) { 471 { 472 // Chrome/Safari-specific fix: 473 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 474 // made available by removing the scrollbar. The following forces the necessary text reflow. 475 var width = ta.style.width; 476 ta.style.width = '0px'; 477 // Force reflow: 478 /* jshint ignore:start */ 479 ta.offsetWidth; 480 /* jshint ignore:end */ 481 ta.style.width = width; 482 } 483 484 ta.style.overflowY = value; 485 } 486 487 function getParentOverflows(el) { 488 var arr = []; 489 490 while (el && el.parentNode && el.parentNode instanceof Element) { 491 if (el.parentNode.scrollTop) { 492 arr.push({ 493 node: el.parentNode, 494 scrollTop: el.parentNode.scrollTop 495 }); 496 } 497 el = el.parentNode; 498 } 499 500 return arr; 501 } 502 503 function resize() { 504 if (ta.scrollHeight === 0) { 505 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 506 return; 507 } 508 509 var overflows = getParentOverflows(ta); 510 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 511 512 ta.style.height = ''; 513 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 514 515 // used to check if an update is actually necessary on window.resize 516 clientWidth = ta.clientWidth; 517 518 // prevents scroll-position jumping 519 overflows.forEach(function (el) { 520 el.node.scrollTop = el.scrollTop; 521 }); 522 523 if (docTop) { 524 document.documentElement.scrollTop = docTop; 525 } 526 } 527 528 function update() { 529 resize(); 530 531 var styleHeight = Math.round(parseFloat(ta.style.height)); 532 var computed = window.getComputedStyle(ta, null); 533 534 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 535 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 536 537 // The actual height not matching the style height (set via the resize method) indicates that 538 // the max-height has been exceeded, in which case the overflow should be allowed. 539 if (actualHeight < styleHeight) { 540 if (computed.overflowY === 'hidden') { 541 changeOverflow('scroll'); 542 resize(); 543 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 544 } 545 } else { 546 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 547 if (computed.overflowY !== 'hidden') { 548 changeOverflow('hidden'); 549 resize(); 550 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 551 } 552 } 553 554 if (cachedHeight !== actualHeight) { 555 cachedHeight = actualHeight; 556 var evt = createEvent('autosize:resized'); 557 try { 558 ta.dispatchEvent(evt); 559 } catch (err) { 560 // Firefox will throw an error on dispatchEvent for a detached element 561 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 562 } 563 } 564 } 565 566 var pageResize = function pageResize() { 567 if (ta.clientWidth !== clientWidth) { 568 update(); 569 } 570 }; 571 572 var destroy = function (style) { 573 window.removeEventListener('resize', pageResize, false); 574 ta.removeEventListener('input', update, false); 575 ta.removeEventListener('keyup', update, false); 576 ta.removeEventListener('autosize:destroy', destroy, false); 577 ta.removeEventListener('autosize:update', update, false); 578 579 Object.keys(style).forEach(function (key) { 580 ta.style[key] = style[key]; 581 }); 582 583 map.delete(ta); 584 }.bind(ta, { 585 height: ta.style.height, 586 resize: ta.style.resize, 587 overflowY: ta.style.overflowY, 588 overflowX: ta.style.overflowX, 589 wordWrap: ta.style.wordWrap 590 }); 591 592 ta.addEventListener('autosize:destroy', destroy, false); 593 594 // IE9 does not fire onpropertychange or oninput for deletions, 595 // so binding to onkeyup to catch most of those events. 596 // There is no way that I know of to detect something like 'cut' in IE9. 597 if ('onpropertychange' in ta && 'oninput' in ta) { 598 ta.addEventListener('keyup', update, false); 599 } 600 601 window.addEventListener('resize', pageResize, false); 602 ta.addEventListener('input', update, false); 603 ta.addEventListener('autosize:update', update, false); 604 ta.style.overflowX = 'hidden'; 605 ta.style.wordWrap = 'break-word'; 606 607 map.set(ta, { 608 destroy: destroy, 609 update: update 610 }); 611 612 init(); 613 } 614 615 function destroy(ta) { 616 var methods = map.get(ta); 617 if (methods) { 618 methods.destroy(); 619 } 620 } 621 622 function update(ta) { 623 var methods = map.get(ta); 624 if (methods) { 625 methods.update(); 626 } 627 } 628 629 var autosize = null; 630 631 // Do nothing in Node.js environment and IE8 (or lower) 632 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 633 autosize = function autosize(el) { 634 return el; 635 }; 636 autosize.destroy = function (el) { 637 return el; 638 }; 639 autosize.update = function (el) { 640 return el; 641 }; 642 } else { 643 autosize = function autosize(el, options) { 644 if (el) { 645 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 646 return assign(x, options); 647 }); 648 } 649 return el; 650 }; 651 autosize.destroy = function (el) { 652 if (el) { 653 Array.prototype.forEach.call(el.length ? el : [el], destroy); 654 } 655 return el; 656 }; 657 autosize.update = function (el) { 658 if (el) { 659 Array.prototype.forEach.call(el.length ? el : [el], update); 660 } 661 return el; 662 }; 663 } 664 665 exports.default = autosize; 666 module.exports = exports['default']; 667 }); 668 669 /***/ }), 670 671 /***/ "HSyU": 672 /***/ (function(module, exports) { 673 674 (function() { module.exports = window["wp"]["blocks"]; }()); 675 676 /***/ }), 677 678 /***/ "JREk": 679 /***/ (function(module, exports) { 680 681 (function() { module.exports = window["wp"]["serverSideRender"]; }()); 682 683 /***/ }), 684 685 /***/ "K2cm": 686 /***/ (function(module, __webpack_exports__, __webpack_require__) { 687 688 "use strict"; 689 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 690 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 691 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 692 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 693 694 695 /** 696 * WordPress dependencies 697 */ 698 699 const redo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 700 xmlns: "http://www.w3.org/2000/svg", 701 viewBox: "0 0 24 24" 702 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 703 d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" 704 })); 705 /* harmony default export */ __webpack_exports__["a"] = (redo); 706 707 708 /***/ }), 709 710 /***/ "K9lf": 711 /***/ (function(module, exports) { 712 713 (function() { module.exports = window["wp"]["compose"]; }()); 714 715 /***/ }), 716 717 /***/ "Mmq9": 718 /***/ (function(module, exports) { 719 720 (function() { module.exports = window["wp"]["url"]; }()); 721 722 /***/ }), 723 724 /***/ "NMb1": 725 /***/ (function(module, exports) { 726 727 (function() { module.exports = window["wp"]["deprecated"]; }()); 728 729 /***/ }), 730 731 /***/ "Ntru": 732 /***/ (function(module, __webpack_exports__, __webpack_require__) { 733 734 "use strict"; 735 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 736 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 737 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 738 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 739 740 741 /** 742 * WordPress dependencies 743 */ 744 745 const undo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 746 xmlns: "http://www.w3.org/2000/svg", 747 viewBox: "0 0 24 24" 748 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 749 d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" 750 })); 751 /* harmony default export */ __webpack_exports__["a"] = (undo); 752 753 754 /***/ }), 755 756 /***/ "O6Fj": 757 /***/ (function(module, exports, __webpack_require__) { 758 759 "use strict"; 760 761 exports.__esModule = true; 762 var TextareaAutosize_1 = __webpack_require__("CNgt"); 763 exports["default"] = TextareaAutosize_1.TextareaAutosize; 764 765 766 /***/ }), 767 768 /***/ "PLxR": 769 /***/ (function(module, __webpack_exports__, __webpack_require__) { 770 771 "use strict"; 772 // ESM COMPAT FLAG 773 __webpack_require__.r(__webpack_exports__); 774 775 // EXPORTS 776 __webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; }); 777 __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; }); 778 __webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return /* reexport */ autocompleters_user; }); 779 __webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return /* reexport */ autosave_monitor; }); 780 __webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return /* reexport */ document_outline; }); 781 __webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return /* reexport */ check; }); 782 __webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return /* reexport */ visual_editor_shortcuts; }); 783 __webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; }); 784 __webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", function() { return /* reexport */ register_shortcuts; }); 785 __webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; }); 786 __webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; }); 787 __webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; }); 788 __webpack_require__.d(__webpack_exports__, "EditorSnackbars", function() { return /* reexport */ EditorSnackbars; }); 789 __webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; }); 790 __webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; }); 791 __webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; }); 792 __webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return /* reexport */ page_attributes_check; }); 793 __webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return /* reexport */ page_attributes_order; }); 794 __webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return /* reexport */ page_attributes_parent; }); 795 __webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return /* reexport */ post_template; }); 796 __webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return /* reexport */ post_author; }); 797 __webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return /* reexport */ post_author_check; }); 798 __webpack_require__.d(__webpack_exports__, "PostComments", function() { return /* reexport */ post_comments; }); 799 __webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return /* reexport */ post_excerpt; }); 800 __webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return /* reexport */ post_excerpt_check; }); 801 __webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return /* reexport */ post_featured_image; }); 802 __webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return /* reexport */ post_featured_image_check; }); 803 __webpack_require__.d(__webpack_exports__, "PostFormat", function() { return /* reexport */ PostFormat; }); 804 __webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return /* reexport */ post_format_check; }); 805 __webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return /* reexport */ post_last_revision; }); 806 __webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return /* reexport */ post_last_revision_check; }); 807 __webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return /* reexport */ PostLockedModal; }); 808 __webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return /* reexport */ post_pending_status; }); 809 __webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return /* reexport */ post_pending_status_check; }); 810 __webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return /* reexport */ post_pingbacks; }); 811 __webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return /* reexport */ post_preview_button; }); 812 __webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return /* reexport */ post_publish_button; }); 813 __webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return /* reexport */ post_publish_button_label; }); 814 __webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return /* reexport */ post_publish_panel; }); 815 __webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return /* reexport */ PostSavedState; }); 816 __webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return /* reexport */ PostSchedule; }); 817 __webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return /* reexport */ post_schedule_check; }); 818 __webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return /* reexport */ post_schedule_label; }); 819 __webpack_require__.d(__webpack_exports__, "PostSlug", function() { return /* reexport */ post_slug; }); 820 __webpack_require__.d(__webpack_exports__, "PostSlugCheck", function() { return /* reexport */ PostSlugCheck; }); 821 __webpack_require__.d(__webpack_exports__, "PostSticky", function() { return /* reexport */ post_sticky; }); 822 __webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return /* reexport */ post_sticky_check; }); 823 __webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return /* reexport */ post_switch_to_draft_button; }); 824 __webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return /* reexport */ post_taxonomies; }); 825 __webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return /* reexport */ post_taxonomies_check; }); 826 __webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return /* reexport */ PostTextEditor; }); 827 __webpack_require__.d(__webpack_exports__, "PostTitle", function() { return /* reexport */ PostTitle; }); 828 __webpack_require__.d(__webpack_exports__, "PostTrash", function() { return /* reexport */ post_trash; }); 829 __webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return /* reexport */ post_trash_check; }); 830 __webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return /* reexport */ post_type_support_check; }); 831 __webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return /* reexport */ post_visibility; }); 832 __webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return /* reexport */ post_visibility_label; }); 833 __webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return /* reexport */ post_visibility_check; }); 834 __webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return /* reexport */ table_of_contents; }); 835 __webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return /* reexport */ UnsavedChangesWarning; }); 836 __webpack_require__.d(__webpack_exports__, "WordCount", function() { return /* reexport */ WordCount; }); 837 __webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return /* reexport */ provider; }); 838 __webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return /* reexport */ external_wp_serverSideRender_default.a; }); 839 __webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ RichText; }); 840 __webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; }); 841 __webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; }); 842 __webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; }); 843 __webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ BlockControls; }); 844 __webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ deprecated_BlockEdit; }); 845 __webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ BlockEditorKeyboardShortcuts; }); 846 __webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; }); 847 __webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; }); 848 __webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ BlockInspector; }); 849 __webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; }); 850 __webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ BlockMover; }); 851 __webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ BlockNavigationDropdown; }); 852 __webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; }); 853 __webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ BlockSettingsMenu; }); 854 __webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; }); 855 __webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; }); 856 __webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; }); 857 __webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ ContrastChecker; }); 858 __webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ CopyHandler; }); 859 __webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ DefaultBlockAppender; }); 860 __webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ FontSizePicker; }); 861 __webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ Inserter; }); 862 __webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ InnerBlocks; }); 863 __webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ InspectorAdvancedControls; }); 864 __webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ InspectorControls; }); 865 __webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ PanelColorSettings; }); 866 __webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ PlainText; }); 867 __webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; }); 868 __webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; }); 869 __webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ __unstableRichTextInputEvent; }); 870 __webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ MediaPlaceholder; }); 871 __webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ MediaUpload; }); 872 __webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ MediaUploadCheck; }); 873 __webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; }); 874 __webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ NavigableToolbar; }); 875 __webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ ObserveTyping; }); 876 __webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; }); 877 __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ SkipToSelectedBlock; }); 878 __webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ URLInput; }); 879 __webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ URLInputButton; }); 880 __webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ URLPopover; }); 881 __webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ Warning; }); 882 __webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; }); 883 __webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; }); 884 __webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; }); 885 __webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; }); 886 __webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; }); 887 __webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; }); 888 __webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; }); 889 __webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ withColorContext; }); 890 __webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; }); 891 __webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ withFontSizes; }); 892 __webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return /* reexport */ mediaUpload; }); 893 __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; }); 894 __webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ external_wp_blockEditor_["transformStyles"]; }); 895 896 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js 897 var selectors_namespaceObject = {}; 898 __webpack_require__.r(selectors_namespaceObject); 899 __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; }); 900 __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; }); 901 __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; }); 902 __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; }); 903 __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; }); 904 __webpack_require__.d(selectors_namespaceObject, "hasNonPostEntityChanges", function() { return selectors_hasNonPostEntityChanges; }); 905 __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; }); 906 __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; }); 907 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; }); 908 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; }); 909 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; }); 910 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; }); 911 __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return selectors_getPostEdits; }); 912 __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; }); 913 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; }); 914 __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; }); 915 __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; }); 916 __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; }); 917 __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPending", function() { return isCurrentPostPending; }); 918 __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPublished", function() { return selectors_isCurrentPostPublished; }); 919 __webpack_require__.d(selectors_namespaceObject, "isCurrentPostScheduled", function() { return selectors_isCurrentPostScheduled; }); 920 __webpack_require__.d(selectors_namespaceObject, "isEditedPostPublishable", function() { return selectors_isEditedPostPublishable; }); 921 __webpack_require__.d(selectors_namespaceObject, "isEditedPostSaveable", function() { return selectors_isEditedPostSaveable; }); 922 __webpack_require__.d(selectors_namespaceObject, "isEditedPostEmpty", function() { return isEditedPostEmpty; }); 923 __webpack_require__.d(selectors_namespaceObject, "isEditedPostAutosaveable", function() { return selectors_isEditedPostAutosaveable; }); 924 __webpack_require__.d(selectors_namespaceObject, "getAutosave", function() { return getAutosave; }); 925 __webpack_require__.d(selectors_namespaceObject, "hasAutosave", function() { return hasAutosave; }); 926 __webpack_require__.d(selectors_namespaceObject, "isEditedPostBeingScheduled", function() { return selectors_isEditedPostBeingScheduled; }); 927 __webpack_require__.d(selectors_namespaceObject, "isEditedPostDateFloating", function() { return isEditedPostDateFloating; }); 928 __webpack_require__.d(selectors_namespaceObject, "isSavingPost", function() { return selectors_isSavingPost; }); 929 __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestSucceed", function() { return didPostSaveRequestSucceed; }); 930 __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestFail", function() { return didPostSaveRequestFail; }); 931 __webpack_require__.d(selectors_namespaceObject, "isAutosavingPost", function() { return selectors_isAutosavingPost; }); 932 __webpack_require__.d(selectors_namespaceObject, "isPreviewingPost", function() { return isPreviewingPost; }); 933 __webpack_require__.d(selectors_namespaceObject, "getEditedPostPreviewLink", function() { return selectors_getEditedPostPreviewLink; }); 934 __webpack_require__.d(selectors_namespaceObject, "getSuggestedPostFormat", function() { return selectors_getSuggestedPostFormat; }); 935 __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; }); 936 __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; }); 937 __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; }); 938 __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return isPermalinkEditable; }); 939 __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; }); 940 __webpack_require__.d(selectors_namespaceObject, "getEditedPostSlug", function() { return getEditedPostSlug; }); 941 __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return getPermalinkParts; }); 942 __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return selectors_isPostLocked; }); 943 __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; }); 944 __webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; }); 945 __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; }); 946 __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; }); 947 __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; }); 948 __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; }); 949 __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; }); 950 __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return getEditorBlocks; }); 951 __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionStart", function() { return getEditorSelectionStart; }); 952 __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionEnd", function() { return getEditorSelectionEnd; }); 953 __webpack_require__.d(selectors_namespaceObject, "getEditorSelection", function() { return selectors_getEditorSelection; }); 954 __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return selectors_unstableIsEditorReady; }); 955 __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; }); 956 __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; }); 957 __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; }); 958 __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; }); 959 __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; }); 960 __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; }); 961 __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; }); 962 __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); 963 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; }); 964 __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; }); 965 __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; }); 966 __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return selectors_getGlobalBlockCount; }); 967 __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; }); 968 __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; }); 969 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; }); 970 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; }); 971 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; }); 972 __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; }); 973 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; }); 974 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; }); 975 __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; }); 976 __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; }); 977 __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); 978 __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; }); 979 __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; }); 980 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return getSelectedBlocksInitialCaretPosition; }); 981 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return getMultiSelectedBlockClientIds; }); 982 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; }); 983 __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; }); 984 __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; }); 985 __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return isFirstMultiSelectedBlock; }); 986 __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return isBlockMultiSelected; }); 987 __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return isAncestorMultiSelected; }); 988 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; }); 989 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; }); 990 __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return getBlockOrder; }); 991 __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return getBlockIndex; }); 992 __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return isBlockSelected; }); 993 __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return hasSelectedInnerBlock; }); 994 __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; }); 995 __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; }); 996 __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; }); 997 __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; }); 998 __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; }); 999 __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; }); 1000 __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; }); 1001 __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; }); 1002 __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; }); 1003 __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; }); 1004 __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; }); 1005 __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; }); 1006 __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; }); 1007 __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; }); 1008 __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; }); 1009 __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; }); 1010 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateTypes", function() { return __experimentalGetDefaultTemplateTypes; }); 1011 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplatePartAreas", function() { return __experimentalGetDefaultTemplatePartAreas; }); 1012 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateType", function() { return __experimentalGetDefaultTemplateType; }); 1013 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetTemplateInfo", function() { return __experimentalGetTemplateInfo; }); 1014 1015 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js 1016 var actions_namespaceObject = {}; 1017 __webpack_require__.r(actions_namespaceObject); 1018 __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return actions_setupEditor; }); 1019 __webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return actions_experimentalTearDownEditor; }); 1020 __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; }); 1021 __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; }); 1022 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; }); 1023 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; }); 1024 __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; }); 1025 __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; }); 1026 __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; }); 1027 __webpack_require__.d(actions_namespaceObject, "savePost", function() { return actions_savePost; }); 1028 __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; }); 1029 __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; }); 1030 __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; }); 1031 __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; }); 1032 __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; }); 1033 __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; }); 1034 __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return actions_updatePostLock; }); 1035 __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; }); 1036 __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; }); 1037 __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; }); 1038 __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; }); 1039 __webpack_require__.d(actions_namespaceObject, "lockPostAutosaving", function() { return lockPostAutosaving; }); 1040 __webpack_require__.d(actions_namespaceObject, "unlockPostAutosaving", function() { return unlockPostAutosaving; }); 1041 __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; }); 1042 __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return actions_updateEditorSettings; }); 1043 __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; }); 1044 __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); 1045 __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; }); 1046 __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; }); 1047 __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; }); 1048 __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; }); 1049 __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; }); 1050 __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; }); 1051 __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; }); 1052 __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; }); 1053 __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; }); 1054 __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; }); 1055 __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; }); 1056 __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; }); 1057 __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; }); 1058 __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; }); 1059 __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; }); 1060 __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return showInsertionPoint; }); 1061 __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return hideInsertionPoint; }); 1062 __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return actions_setTemplateValidity; }); 1063 __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return actions_synchronizeTemplate; }); 1064 __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; }); 1065 __webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return removeBlocks; }); 1066 __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; }); 1067 __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; }); 1068 __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; }); 1069 __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; }); 1070 __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; }); 1071 __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; }); 1072 __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; }); 1073 __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; }); 1074 1075 // EXTERNAL MODULE: external ["wp","blockEditor"] 1076 var external_wp_blockEditor_ = __webpack_require__("axFQ"); 1077 1078 // EXTERNAL MODULE: external ["wp","coreData"] 1079 var external_wp_coreData_ = __webpack_require__("jZUy"); 1080 1081 // EXTERNAL MODULE: external ["wp","richText"] 1082 var external_wp_richText_ = __webpack_require__("qRz9"); 1083 1084 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 1085 var esm_extends = __webpack_require__("wx14"); 1086 1087 // EXTERNAL MODULE: external ["wp","element"] 1088 var external_wp_element_ = __webpack_require__("GRId"); 1089 1090 // EXTERNAL MODULE: external "lodash" 1091 var external_lodash_ = __webpack_require__("YLtl"); 1092 1093 // EXTERNAL MODULE: external ["wp","blocks"] 1094 var external_wp_blocks_ = __webpack_require__("HSyU"); 1095 1096 // EXTERNAL MODULE: external ["wp","data"] 1097 var external_wp_data_ = __webpack_require__("1ZqX"); 1098 1099 // EXTERNAL MODULE: external ["wp","compose"] 1100 var external_wp_compose_ = __webpack_require__("K9lf"); 1101 1102 // EXTERNAL MODULE: external ["wp","hooks"] 1103 var external_wp_hooks_ = __webpack_require__("g56x"); 1104 1105 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js 1106 1107 1108 1109 /** 1110 * External dependencies 1111 */ 1112 1113 /** 1114 * WordPress dependencies 1115 */ 1116 1117 1118 1119 1120 1121 1122 1123 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ 1124 1125 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 1126 1127 /** 1128 * Object whose keys are the names of block attributes, where each value 1129 * represents the meta key to which the block attribute is intended to save. 1130 * 1131 * @see https://developer.wordpress.org/reference/functions/register_meta/ 1132 * 1133 * @typedef {Object<string,string>} WPMetaAttributeMapping 1134 */ 1135 1136 /** 1137 * Given a mapping of attribute names (meta source attributes) to their 1138 * associated meta key, returns a higher order component that overrides its 1139 * `attributes` and `setAttributes` props to sync any changes with the edited 1140 * post's meta keys. 1141 * 1142 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. 1143 * 1144 * @return {WPHigherOrderComponent} Higher-order component. 1145 */ 1146 1147 const createWithMetaAttributeSource = metaAttributes => Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => ({ 1148 attributes, 1149 setAttributes, 1150 ...props 1151 }) => { 1152 const postType = Object(external_wp_data_["useSelect"])(select => select('core/editor').getCurrentPostType(), []); 1153 const [meta, setMeta] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'meta'); 1154 const mergedAttributes = Object(external_wp_element_["useMemo"])(() => ({ ...attributes, 1155 ...Object(external_lodash_["mapValues"])(metaAttributes, metaKey => meta[metaKey]) 1156 }), [attributes, meta]); 1157 return Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ 1158 attributes: mergedAttributes, 1159 setAttributes: nextAttributes => { 1160 const nextMeta = Object(external_lodash_["mapKeys"])( // Filter to intersection of keys between the updated 1161 // attributes and those with an associated meta key. 1162 Object(external_lodash_["pickBy"])(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name. 1163 (value, attributeKey) => metaAttributes[attributeKey]); 1164 1165 if (!Object(external_lodash_["isEmpty"])(nextMeta)) { 1166 setMeta(nextMeta); 1167 } 1168 1169 setAttributes(nextAttributes); 1170 } 1171 }, props)); 1172 }, 'withMetaAttributeSource'); 1173 /** 1174 * Filters a registered block's settings to enhance a block's `edit` component 1175 * to upgrade meta-sourced attributes to use the post's meta entity property. 1176 * 1177 * @param {WPBlockSettings} settings Registered block settings. 1178 * 1179 * @return {WPBlockSettings} Filtered block settings. 1180 */ 1181 1182 1183 function shimAttributeSource(settings) { 1184 /** @type {WPMetaAttributeMapping} */ 1185 const metaAttributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(settings.attributes, { 1186 source: 'meta' 1187 }), 'meta'); 1188 1189 if (!Object(external_lodash_["isEmpty"])(metaAttributes)) { 1190 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); 1191 } 1192 1193 return settings; 1194 } 1195 1196 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was 1197 // added. There may already be blocks registered by this point, and those must 1198 // be updated to apply the shim. 1199 // 1200 // The following implementation achieves this, albeit with a couple caveats: 1201 // - Only blocks registered on the global store will be modified. 1202 // - The block settings are directly mutated, since there is currently no 1203 // mechanism to update an existing block registration. This is the reason for 1204 // `getBlockType` separate from `getBlockTypes`, since the latter returns a 1205 // _copy_ of the block registration (i.e. the mutation would not affect the 1206 // actual registered block settings). 1207 // 1208 // `getBlockTypes` or `getBlockType` implementation could change in the future 1209 // in regards to creating settings clones, but the corresponding end-to-end 1210 // tests for meta blocks should cover against any potential regressions. 1211 // 1212 // In the future, we could support updating block settings, at which point this 1213 // implementation could use that mechanism instead. 1214 1215 Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockTypes().map(({ 1216 name 1217 }) => Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockType(name)).forEach(shimAttributeSource); 1218 1219 // EXTERNAL MODULE: external ["wp","apiFetch"] 1220 var external_wp_apiFetch_ = __webpack_require__("ywyh"); 1221 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); 1222 1223 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js 1224 1225 1226 /** 1227 * WordPress dependencies 1228 */ 1229 1230 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ 1231 1232 /** 1233 * A user mentions completer. 1234 * 1235 * @type {WPCompleter} 1236 */ 1237 1238 /* harmony default export */ var autocompleters_user = ({ 1239 name: 'users', 1240 className: 'editor-autocompleters__user', 1241 triggerPrefix: '@', 1242 1243 options(search) { 1244 let payload = ''; 1245 1246 if (search) { 1247 payload = '?search=' + encodeURIComponent(search); 1248 } 1249 1250 return external_wp_apiFetch_default()({ 1251 path: '/wp/v2/users' + payload 1252 }); 1253 }, 1254 1255 isDebounced: true, 1256 1257 getOptionKeywords(user) { 1258 return [user.slug, user.name]; 1259 }, 1260 1261 getOptionLabel(user) { 1262 const avatar = user.avatar_urls && user.avatar_urls[24] ? Object(external_wp_element_["createElement"])("img", { 1263 key: "avatar", 1264 className: "editor-autocompleters__user-avatar", 1265 alt: "", 1266 src: user.avatar_urls[24] 1267 }) : Object(external_wp_element_["createElement"])("span", { 1268 className: "editor-autocompleters__no-avatar" 1269 }); 1270 return [avatar, Object(external_wp_element_["createElement"])("span", { 1271 key: "name", 1272 className: "editor-autocompleters__user-name" 1273 }, user.name), Object(external_wp_element_["createElement"])("span", { 1274 key: "slug", 1275 className: "editor-autocompleters__user-slug" 1276 }, user.slug)]; 1277 }, 1278 1279 getOptionCompletion(user) { 1280 return `@${user.slug}`; 1281 } 1282 1283 }); 1284 1285 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js 1286 /** 1287 * External dependencies 1288 */ 1289 1290 /** 1291 * WordPress dependencies 1292 */ 1293 1294 1295 /** 1296 * Internal dependencies 1297 */ 1298 1299 1300 1301 function setDefaultCompleters(completers = []) { 1302 // Provide copies so filters may directly modify them. 1303 completers.push(Object(external_lodash_["clone"])(autocompleters_user)); 1304 return completers; 1305 } 1306 1307 Object(external_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); 1308 1309 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js 1310 /** 1311 * Internal dependencies 1312 */ 1313 1314 1315 1316 // EXTERNAL MODULE: external ["wp","dataControls"] 1317 var external_wp_dataControls_ = __webpack_require__("51Zz"); 1318 1319 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js 1320 /** 1321 * WordPress dependencies 1322 */ 1323 1324 const PREFERENCES_DEFAULTS = { 1325 insertUsage: {}, 1326 // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580. 1327 isPublishSidebarEnabled: true 1328 }; 1329 /** 1330 * The default post editor settings 1331 * 1332 * allowedBlockTypes boolean|Array Allowed block types 1333 * richEditingEnabled boolean Whether rich editing is enabled or not 1334 * codeEditingEnabled boolean Whether code editing is enabled or not 1335 * enableCustomFields boolean Whether the WordPress custom fields are enabled or not 1336 * autosaveInterval number Autosave Interval 1337 * availableTemplates array? The available post templates 1338 * disablePostFormats boolean Whether or not the post formats are disabled 1339 * allowedMimeTypes array? List of allowed mime types and file extensions 1340 * maxUploadFileSize number Maximum upload file size 1341 * supportsLayout boolean Whether the editor supports layouts. 1342 */ 1343 1344 const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_["SETTINGS_DEFAULTS"], 1345 richEditingEnabled: true, 1346 codeEditingEnabled: true, 1347 enableCustomFields: false, 1348 supportsLayout: true 1349 }; 1350 1351 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js 1352 /** 1353 * External dependencies 1354 */ 1355 1356 /** 1357 * WordPress dependencies 1358 */ 1359 1360 1361 /** 1362 * Internal dependencies 1363 */ 1364 1365 1366 /** 1367 * Returns a post attribute value, flattening nested rendered content using its 1368 * raw value in place of its original object form. 1369 * 1370 * @param {*} value Original value. 1371 * 1372 * @return {*} Raw value. 1373 */ 1374 1375 function getPostRawValue(value) { 1376 if (value && 'object' === typeof value && 'raw' in value) { 1377 return value.raw; 1378 } 1379 1380 return value; 1381 } 1382 /** 1383 * Returns true if the two object arguments have the same keys, or false 1384 * otherwise. 1385 * 1386 * @param {Object} a First object. 1387 * @param {Object} b Second object. 1388 * 1389 * @return {boolean} Whether the two objects have the same keys. 1390 */ 1391 1392 function hasSameKeys(a, b) { 1393 return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b)); 1394 } 1395 /** 1396 * Returns true if, given the currently dispatching action and the previously 1397 * dispatched action, the two actions are editing the same post property, or 1398 * false otherwise. 1399 * 1400 * @param {Object} action Currently dispatching action. 1401 * @param {Object} previousAction Previously dispatched action. 1402 * 1403 * @return {boolean} Whether actions are updating the same post property. 1404 */ 1405 1406 function isUpdatingSamePostProperty(action, previousAction) { 1407 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); 1408 } 1409 /** 1410 * Returns true if, given the currently dispatching action and the previously 1411 * dispatched action, the two actions are modifying the same property such that 1412 * undo history should be batched. 1413 * 1414 * @param {Object} action Currently dispatching action. 1415 * @param {Object} previousAction Previously dispatched action. 1416 * 1417 * @return {boolean} Whether to overwrite present state. 1418 */ 1419 1420 function shouldOverwriteState(action, previousAction) { 1421 if (action.type === 'RESET_EDITOR_BLOCKS') { 1422 return !action.shouldCreateUndoLevel; 1423 } 1424 1425 if (!previousAction || action.type !== previousAction.type) { 1426 return false; 1427 } 1428 1429 return isUpdatingSamePostProperty(action, previousAction); 1430 } 1431 function reducer_postId(state = null, action) { 1432 switch (action.type) { 1433 case 'SETUP_EDITOR_STATE': 1434 case 'RESET_POST': 1435 return action.post.id; 1436 } 1437 1438 return state; 1439 } 1440 function reducer_postType(state = null, action) { 1441 switch (action.type) { 1442 case 'SETUP_EDITOR_STATE': 1443 case 'RESET_POST': 1444 return action.post.type; 1445 } 1446 1447 return state; 1448 } 1449 /** 1450 * Reducer returning whether the post blocks match the defined template or not. 1451 * 1452 * @param {Object} state Current state. 1453 * @param {Object} action Dispatched action. 1454 * 1455 * @return {boolean} Updated state. 1456 */ 1457 1458 function reducer_template(state = { 1459 isValid: true 1460 }, action) { 1461 switch (action.type) { 1462 case 'SET_TEMPLATE_VALIDITY': 1463 return { ...state, 1464 isValid: action.isValid 1465 }; 1466 } 1467 1468 return state; 1469 } 1470 /** 1471 * Reducer returning the user preferences. 1472 * 1473 * @param {Object} state Current state. 1474 * @param {Object} action Dispatched action. 1475 * 1476 * @return {string} Updated state. 1477 */ 1478 1479 function preferences(state = PREFERENCES_DEFAULTS, action) { 1480 switch (action.type) { 1481 case 'ENABLE_PUBLISH_SIDEBAR': 1482 return { ...state, 1483 isPublishSidebarEnabled: true 1484 }; 1485 1486 case 'DISABLE_PUBLISH_SIDEBAR': 1487 return { ...state, 1488 isPublishSidebarEnabled: false 1489 }; 1490 } 1491 1492 return state; 1493 } 1494 /** 1495 * Reducer returning current network request state (whether a request to 1496 * the WP REST API is in progress, successful, or failed). 1497 * 1498 * @param {Object} state Current state. 1499 * @param {Object} action Dispatched action. 1500 * 1501 * @return {Object} Updated state. 1502 */ 1503 1504 function saving(state = {}, action) { 1505 switch (action.type) { 1506 case 'REQUEST_POST_UPDATE_START': 1507 case 'REQUEST_POST_UPDATE_FINISH': 1508 return { 1509 pending: action.type === 'REQUEST_POST_UPDATE_START', 1510 options: action.options || {} 1511 }; 1512 } 1513 1514 return state; 1515 } 1516 /** 1517 * Post Lock State. 1518 * 1519 * @typedef {Object} PostLockState 1520 * 1521 * @property {boolean} isLocked Whether the post is locked. 1522 * @property {?boolean} isTakeover Whether the post editing has been taken over. 1523 * @property {?boolean} activePostLock Active post lock value. 1524 * @property {?Object} user User that took over the post. 1525 */ 1526 1527 /** 1528 * Reducer returning the post lock status. 1529 * 1530 * @param {PostLockState} state Current state. 1531 * @param {Object} action Dispatched action. 1532 * 1533 * @return {PostLockState} Updated state. 1534 */ 1535 1536 function postLock(state = { 1537 isLocked: false 1538 }, action) { 1539 switch (action.type) { 1540 case 'UPDATE_POST_LOCK': 1541 return action.lock; 1542 } 1543 1544 return state; 1545 } 1546 /** 1547 * Post saving lock. 1548 * 1549 * When post saving is locked, the post cannot be published or updated. 1550 * 1551 * @param {PostLockState} state Current state. 1552 * @param {Object} action Dispatched action. 1553 * 1554 * @return {PostLockState} Updated state. 1555 */ 1556 1557 function postSavingLock(state = {}, action) { 1558 switch (action.type) { 1559 case 'LOCK_POST_SAVING': 1560 return { ...state, 1561 [action.lockName]: true 1562 }; 1563 1564 case 'UNLOCK_POST_SAVING': 1565 return Object(external_lodash_["omit"])(state, action.lockName); 1566 } 1567 1568 return state; 1569 } 1570 /** 1571 * Post autosaving lock. 1572 * 1573 * When post autosaving is locked, the post will not autosave. 1574 * 1575 * @param {PostLockState} state Current state. 1576 * @param {Object} action Dispatched action. 1577 * 1578 * @return {PostLockState} Updated state. 1579 */ 1580 1581 function postAutosavingLock(state = {}, action) { 1582 switch (action.type) { 1583 case 'LOCK_POST_AUTOSAVING': 1584 return { ...state, 1585 [action.lockName]: true 1586 }; 1587 1588 case 'UNLOCK_POST_AUTOSAVING': 1589 return Object(external_lodash_["omit"])(state, action.lockName); 1590 } 1591 1592 return state; 1593 } 1594 /** 1595 * Reducer returning whether the editor is ready to be rendered. 1596 * The editor is considered ready to be rendered once 1597 * the post object is loaded properly and the initial blocks parsed. 1598 * 1599 * @param {boolean} state 1600 * @param {Object} action 1601 * 1602 * @return {boolean} Updated state. 1603 */ 1604 1605 function reducer_isReady(state = false, action) { 1606 switch (action.type) { 1607 case 'SETUP_EDITOR_STATE': 1608 return true; 1609 1610 case 'TEAR_DOWN_EDITOR': 1611 return false; 1612 } 1613 1614 return state; 1615 } 1616 /** 1617 * Reducer returning the post editor setting. 1618 * 1619 * @param {Object} state Current state. 1620 * @param {Object} action Dispatched action. 1621 * 1622 * @return {Object} Updated state. 1623 */ 1624 1625 function reducer_editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { 1626 switch (action.type) { 1627 case 'UPDATE_EDITOR_SETTINGS': 1628 return { ...state, 1629 ...action.settings 1630 }; 1631 } 1632 1633 return state; 1634 } 1635 /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ 1636 postId: reducer_postId, 1637 postType: reducer_postType, 1638 preferences, 1639 saving, 1640 postLock, 1641 template: reducer_template, 1642 postSavingLock, 1643 isReady: reducer_isReady, 1644 editorSettings: reducer_editorSettings, 1645 postAutosavingLock 1646 })); 1647 1648 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js 1649 var rememo = __webpack_require__("pPDe"); 1650 1651 // EXTERNAL MODULE: external ["wp","date"] 1652 var external_wp_date_ = __webpack_require__("FqII"); 1653 1654 // EXTERNAL MODULE: external ["wp","url"] 1655 var external_wp_url_ = __webpack_require__("Mmq9"); 1656 1657 // EXTERNAL MODULE: external ["wp","deprecated"] 1658 var external_wp_deprecated_ = __webpack_require__("NMb1"); 1659 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); 1660 1661 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 1662 var layout = __webpack_require__("Civd"); 1663 1664 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js 1665 /** 1666 * Set of post properties for which edits should assume a merging behavior, 1667 * assuming an object value. 1668 * 1669 * @type {Set} 1670 */ 1671 const EDIT_MERGE_PROPERTIES = new Set(['meta']); 1672 /** 1673 * Constant for the store module (or reducer) key. 1674 * 1675 * @type {string} 1676 */ 1677 1678 const STORE_NAME = 'core/editor'; 1679 const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; 1680 const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; 1681 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 1682 const ONE_MINUTE_IN_MS = 60 * 1000; 1683 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; 1684 1685 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js 1686 /** 1687 * External dependencies 1688 */ 1689 1690 /** 1691 * WordPress dependencies 1692 */ 1693 1694 1695 /** 1696 * Returns the URL of a WPAdmin Page. 1697 * 1698 * TODO: This should be moved to a module less specific to the editor. 1699 * 1700 * @param {string} page Page to navigate to. 1701 * @param {Object} query Query Args. 1702 * 1703 * @return {string} WPAdmin URL. 1704 */ 1705 1706 function getWPAdminURL(page, query) { 1707 return Object(external_wp_url_["addQueryArgs"])(page, query); 1708 } 1709 /** 1710 * Performs some basic cleanup of a string for use as a post slug 1711 * 1712 * This replicates some of what sanitize_title() does in WordPress core, but 1713 * is only designed to approximate what the slug will be. 1714 * 1715 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. 1716 * Removes combining diacritical marks. Converts whitespace, periods, 1717 * and forward slashes to hyphens. Removes any remaining non-word characters 1718 * except hyphens and underscores. Converts remaining string to lowercase. 1719 * It does not account for octets, HTML entities, or other encoded characters. 1720 * 1721 * @param {string} string Title or slug to be processed 1722 * 1723 * @return {string} Processed string 1724 */ 1725 1726 function cleanForSlug(string) { 1727 if (!string) { 1728 return ''; 1729 } 1730 1731 return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-'); 1732 } 1733 1734 // EXTERNAL MODULE: external ["wp","primitives"] 1735 var external_wp_primitives_ = __webpack_require__("Tqx9"); 1736 1737 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js 1738 1739 1740 /** 1741 * WordPress dependencies 1742 */ 1743 1744 const header = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 1745 xmlns: "http://www.w3.org/2000/svg", 1746 viewBox: "0 0 24 24" 1747 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 1748 d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 1749 })); 1750 /* harmony default export */ var library_header = (header); 1751 1752 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js 1753 1754 1755 /** 1756 * WordPress dependencies 1757 */ 1758 1759 const footer = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 1760 xmlns: "http://www.w3.org/2000/svg", 1761 viewBox: "0 0 24 24" 1762 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 1763 fillRule: "evenodd", 1764 d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 1765 })); 1766 /* harmony default export */ var library_footer = (footer); 1767 1768 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js 1769 1770 1771 /** 1772 * WordPress dependencies 1773 */ 1774 1775 const sidebar = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 1776 xmlns: "http://www.w3.org/2000/svg", 1777 viewBox: "0 0 24 24" 1778 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 1779 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 1780 })); 1781 /* harmony default export */ var library_sidebar = (sidebar); 1782 1783 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/get-template-part-icon.js 1784 /** 1785 * WordPress dependencies 1786 */ 1787 1788 /** 1789 * Helper function to retrieve the corresponding icon by name. 1790 * 1791 * @param {string} iconName The name of the icon. 1792 * 1793 * @return {Object} The corresponding icon. 1794 */ 1795 1796 function getTemplatePartIcon(iconName) { 1797 if ('header' === iconName) { 1798 return library_header; 1799 } else if ('footer' === iconName) { 1800 return library_footer; 1801 } else if ('sidebar' === iconName) { 1802 return library_sidebar; 1803 } 1804 1805 return layout["a" /* default */]; 1806 } 1807 1808 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js 1809 /** 1810 * External dependencies 1811 */ 1812 1813 1814 /** 1815 * WordPress dependencies 1816 */ 1817 1818 1819 1820 1821 1822 1823 1824 1825 /** 1826 * Internal dependencies 1827 */ 1828 1829 1830 1831 1832 1833 1834 /** 1835 * Shared reference to an empty object for cases where it is important to avoid 1836 * returning a new object reference on every invocation, as in a connected or 1837 * other pure component which performs `shouldComponentUpdate` check on props. 1838 * This should be used as a last resort, since the normalized data should be 1839 * maintained by the reducer result in state. 1840 */ 1841 1842 const EMPTY_OBJECT = {}; 1843 /** 1844 * Shared reference to an empty array for cases where it is important to avoid 1845 * returning a new array reference on every invocation, as in a connected or 1846 * other pure component which performs `shouldComponentUpdate` check on props. 1847 * This should be used as a last resort, since the normalized data should be 1848 * maintained by the reducer result in state. 1849 */ 1850 1851 const EMPTY_ARRAY = []; 1852 /** 1853 * Returns true if any past editor history snapshots exist, or false otherwise. 1854 * 1855 * @param {Object} state Global application state. 1856 * 1857 * @return {boolean} Whether undo history exists. 1858 */ 1859 1860 const hasEditorUndo = Object(external_wp_data_["createRegistrySelector"])(select => () => { 1861 return select('core').hasUndo(); 1862 }); 1863 /** 1864 * Returns true if any future editor history snapshots exist, or false 1865 * otherwise. 1866 * 1867 * @param {Object} state Global application state. 1868 * 1869 * @return {boolean} Whether redo history exists. 1870 */ 1871 1872 const hasEditorRedo = Object(external_wp_data_["createRegistrySelector"])(select => () => { 1873 return select('core').hasRedo(); 1874 }); 1875 /** 1876 * Returns true if the currently edited post is yet to be saved, or false if 1877 * the post has been saved. 1878 * 1879 * @param {Object} state Global application state. 1880 * 1881 * @return {boolean} Whether the post is new. 1882 */ 1883 1884 function selectors_isEditedPostNew(state) { 1885 return selectors_getCurrentPost(state).status === 'auto-draft'; 1886 } 1887 /** 1888 * Returns true if content includes unsaved changes, or false otherwise. 1889 * 1890 * @param {Object} state Editor state. 1891 * 1892 * @return {boolean} Whether content includes unsaved changes. 1893 */ 1894 1895 function hasChangedContent(state) { 1896 const edits = selectors_getPostEdits(state); 1897 return 'blocks' in edits || // `edits` is intended to contain only values which are different from 1898 // the saved post, so the mere presence of a property is an indicator 1899 // that the value is different than what is known to be saved. While 1900 // content in Visual mode is represented by the blocks state, in Text 1901 // mode it is tracked by `edits.content`. 1902 'content' in edits; 1903 } 1904 /** 1905 * Returns true if there are unsaved values for the current edit session, or 1906 * false if the editing state matches the saved or new post. 1907 * 1908 * @param {Object} state Global application state. 1909 * 1910 * @return {boolean} Whether unsaved values exist. 1911 */ 1912 1913 const selectors_isEditedPostDirty = Object(external_wp_data_["createRegistrySelector"])(select => state => { 1914 // Edits should contain only fields which differ from the saved post (reset 1915 // at initial load and save complete). Thus, a non-empty edits state can be 1916 // inferred to contain unsaved values. 1917 const postType = selectors_getCurrentPostType(state); 1918 const postId = selectors_getCurrentPostId(state); 1919 1920 if (select('core').hasEditsForEntityRecord('postType', postType, postId)) { 1921 return true; 1922 } 1923 1924 return false; 1925 }); 1926 /** 1927 * Returns true if there are unsaved edits for entities other than 1928 * the editor's post, and false otherwise. 1929 * 1930 * @param {Object} state Global application state. 1931 * 1932 * @return {boolean} Whether there are edits or not. 1933 */ 1934 1935 const selectors_hasNonPostEntityChanges = Object(external_wp_data_["createRegistrySelector"])(select => state => { 1936 const dirtyEntityRecords = select('core').__experimentalGetDirtyEntityRecords(); 1937 1938 const { 1939 type, 1940 id 1941 } = selectors_getCurrentPost(state); 1942 return Object(external_lodash_["some"])(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 1943 }); 1944 /** 1945 * Returns true if there are no unsaved values for the current edit session and 1946 * if the currently edited post is new (has never been saved before). 1947 * 1948 * @param {Object} state Global application state. 1949 * 1950 * @return {boolean} Whether new post and unsaved values exist. 1951 */ 1952 1953 function selectors_isCleanNewPost(state) { 1954 return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state); 1955 } 1956 /** 1957 * Returns the post currently being edited in its last known saved state, not 1958 * including unsaved edits. Returns an object containing relevant default post 1959 * values if the post has not yet been saved. 1960 * 1961 * @param {Object} state Global application state. 1962 * 1963 * @return {Object} Post object. 1964 */ 1965 1966 const selectors_getCurrentPost = Object(external_wp_data_["createRegistrySelector"])(select => state => { 1967 const postId = selectors_getCurrentPostId(state); 1968 const postType = selectors_getCurrentPostType(state); 1969 const post = select('core').getRawEntityRecord('postType', postType, postId); 1970 1971 if (post) { 1972 return post; 1973 } // This exists for compatibility with the previous selector behavior 1974 // which would guarantee an object return based on the editor reducer's 1975 // default empty object state. 1976 1977 1978 return EMPTY_OBJECT; 1979 }); 1980 /** 1981 * Returns the post type of the post currently being edited. 1982 * 1983 * @param {Object} state Global application state. 1984 * 1985 * @return {string} Post type. 1986 */ 1987 1988 function selectors_getCurrentPostType(state) { 1989 return state.postType; 1990 } 1991 /** 1992 * Returns the ID of the post currently being edited, or null if the post has 1993 * not yet been saved. 1994 * 1995 * @param {Object} state Global application state. 1996 * 1997 * @return {?number} ID of current post. 1998 */ 1999 2000 function selectors_getCurrentPostId(state) { 2001 return state.postId; 2002 } 2003 /** 2004 * Returns the number of revisions of the post currently being edited. 2005 * 2006 * @param {Object} state Global application state. 2007 * 2008 * @return {number} Number of revisions. 2009 */ 2010 2011 function getCurrentPostRevisionsCount(state) { 2012 return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); 2013 } 2014 /** 2015 * Returns the last revision ID of the post currently being edited, 2016 * or null if the post has no revisions. 2017 * 2018 * @param {Object} state Global application state. 2019 * 2020 * @return {?number} ID of the last revision. 2021 */ 2022 2023 function getCurrentPostLastRevisionId(state) { 2024 return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); 2025 } 2026 /** 2027 * Returns any post values which have been changed in the editor but not yet 2028 * been saved. 2029 * 2030 * @param {Object} state Global application state. 2031 * 2032 * @return {Object} Object of key value pairs comprising unsaved edits. 2033 */ 2034 2035 const selectors_getPostEdits = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2036 const postType = selectors_getCurrentPostType(state); 2037 const postId = selectors_getCurrentPostId(state); 2038 return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; 2039 }); 2040 /** 2041 * Returns a new reference when edited values have changed. This is useful in 2042 * inferring where an edit has been made between states by comparison of the 2043 * return values using strict equality. 2044 * 2045 * @deprecated since Gutenberg 6.5.0. 2046 * 2047 * @example 2048 * 2049 * ``` 2050 * const hasEditOccurred = ( 2051 * getReferenceByDistinctEdits( beforeState ) !== 2052 * getReferenceByDistinctEdits( afterState ) 2053 * ); 2054 * ``` 2055 * 2056 * @param {Object} state Editor state. 2057 * 2058 * @return {*} A value whose reference will change only when an edit occurs. 2059 */ 2060 2061 const getReferenceByDistinctEdits = Object(external_wp_data_["createRegistrySelector"])(select => () => 2062 /* state */ 2063 { 2064 external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`", { 2065 since: '5.4', 2066 alternative: "`wp.data.select( 'core' ).getReferenceByDistinctEdits`" 2067 }); 2068 return select('core').getReferenceByDistinctEdits(); 2069 }); 2070 /** 2071 * Returns an attribute value of the saved post. 2072 * 2073 * @param {Object} state Global application state. 2074 * @param {string} attributeName Post attribute name. 2075 * 2076 * @return {*} Post attribute value. 2077 */ 2078 2079 function selectors_getCurrentPostAttribute(state, attributeName) { 2080 switch (attributeName) { 2081 case 'type': 2082 return selectors_getCurrentPostType(state); 2083 2084 case 'id': 2085 return selectors_getCurrentPostId(state); 2086 2087 default: 2088 const post = selectors_getCurrentPost(state); 2089 2090 if (!post.hasOwnProperty(attributeName)) { 2091 break; 2092 } 2093 2094 return getPostRawValue(post[attributeName]); 2095 } 2096 } 2097 /** 2098 * Returns a single attribute of the post being edited, preferring the unsaved 2099 * edit if one exists, but merging with the attribute value for the last known 2100 * saved state of the post (this is needed for some nested attributes like meta). 2101 * 2102 * @param {Object} state Global application state. 2103 * @param {string} attributeName Post attribute name. 2104 * 2105 * @return {*} Post attribute value. 2106 */ 2107 2108 const getNestedEditedPostProperty = (state, attributeName) => { 2109 const edits = selectors_getPostEdits(state); 2110 2111 if (!edits.hasOwnProperty(attributeName)) { 2112 return selectors_getCurrentPostAttribute(state, attributeName); 2113 } 2114 2115 return { ...selectors_getCurrentPostAttribute(state, attributeName), 2116 ...edits[attributeName] 2117 }; 2118 }; 2119 /** 2120 * Returns a single attribute of the post being edited, preferring the unsaved 2121 * edit if one exists, but falling back to the attribute for the last known 2122 * saved state of the post. 2123 * 2124 * @param {Object} state Global application state. 2125 * @param {string} attributeName Post attribute name. 2126 * 2127 * @return {*} Post attribute value. 2128 */ 2129 2130 2131 function selectors_getEditedPostAttribute(state, attributeName) { 2132 // Special cases 2133 switch (attributeName) { 2134 case 'content': 2135 return getEditedPostContent(state); 2136 } // Fall back to saved post value if not edited. 2137 2138 2139 const edits = selectors_getPostEdits(state); 2140 2141 if (!edits.hasOwnProperty(attributeName)) { 2142 return selectors_getCurrentPostAttribute(state, attributeName); 2143 } // Merge properties are objects which contain only the patch edit in state, 2144 // and thus must be merged with the current post attribute. 2145 2146 2147 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 2148 return getNestedEditedPostProperty(state, attributeName); 2149 } 2150 2151 return edits[attributeName]; 2152 } 2153 /** 2154 * Returns an attribute value of the current autosave revision for a post, or 2155 * null if there is no autosave for the post. 2156 * 2157 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector 2158 * from the '@wordpress/core-data' package and access properties on the returned 2159 * autosave object using getPostRawValue. 2160 * 2161 * @param {Object} state Global application state. 2162 * @param {string} attributeName Autosave attribute name. 2163 * 2164 * @return {*} Autosave attribute value. 2165 */ 2166 2167 const getAutosaveAttribute = Object(external_wp_data_["createRegistrySelector"])(select => (state, attributeName) => { 2168 if (!Object(external_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') { 2169 return; 2170 } 2171 2172 const postType = selectors_getCurrentPostType(state); 2173 const postId = selectors_getCurrentPostId(state); 2174 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); 2175 const autosave = select('core').getAutosave(postType, postId, currentUserId); 2176 2177 if (autosave) { 2178 return getPostRawValue(autosave[attributeName]); 2179 } 2180 }); 2181 /** 2182 * Returns the current visibility of the post being edited, preferring the 2183 * unsaved value if different than the saved post. The return value is one of 2184 * "private", "password", or "public". 2185 * 2186 * @param {Object} state Global application state. 2187 * 2188 * @return {string} Post visibility. 2189 */ 2190 2191 function selectors_getEditedPostVisibility(state) { 2192 const status = selectors_getEditedPostAttribute(state, 'status'); 2193 2194 if (status === 'private') { 2195 return 'private'; 2196 } 2197 2198 const password = selectors_getEditedPostAttribute(state, 'password'); 2199 2200 if (password) { 2201 return 'password'; 2202 } 2203 2204 return 'public'; 2205 } 2206 /** 2207 * Returns true if post is pending review. 2208 * 2209 * @param {Object} state Global application state. 2210 * 2211 * @return {boolean} Whether current post is pending review. 2212 */ 2213 2214 function isCurrentPostPending(state) { 2215 return selectors_getCurrentPost(state).status === 'pending'; 2216 } 2217 /** 2218 * Return true if the current post has already been published. 2219 * 2220 * @param {Object} state Global application state. 2221 * @param {Object?} currentPost Explicit current post for bypassing registry selector. 2222 * 2223 * @return {boolean} Whether the post has been published. 2224 */ 2225 2226 function selectors_isCurrentPostPublished(state, currentPost) { 2227 const post = currentPost || selectors_getCurrentPost(state); 2228 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_wp_date_["isInTheFuture"])(new Date(Number(Object(external_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS)); 2229 } 2230 /** 2231 * Returns true if post is already scheduled. 2232 * 2233 * @param {Object} state Global application state. 2234 * 2235 * @return {boolean} Whether current post is scheduled to be posted. 2236 */ 2237 2238 function selectors_isCurrentPostScheduled(state) { 2239 return selectors_getCurrentPost(state).status === 'future' && !selectors_isCurrentPostPublished(state); 2240 } 2241 /** 2242 * Return true if the post being edited can be published. 2243 * 2244 * @param {Object} state Global application state. 2245 * 2246 * @return {boolean} Whether the post can been published. 2247 */ 2248 2249 function selectors_isEditedPostPublishable(state) { 2250 const post = selectors_getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post 2251 // being saveable. Currently this restriction is imposed at UI. 2252 // 2253 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`) 2254 2255 return selectors_isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; 2256 } 2257 /** 2258 * Returns true if the post can be saved, or false otherwise. A post must 2259 * contain a title, an excerpt, or non-empty content to be valid for save. 2260 * 2261 * @param {Object} state Global application state. 2262 * 2263 * @return {boolean} Whether the post can be saved. 2264 */ 2265 2266 function selectors_isEditedPostSaveable(state) { 2267 if (selectors_isSavingPost(state)) { 2268 return false; 2269 } // TODO: Post should not be saveable if not dirty. Cannot be added here at 2270 // this time since posts where meta boxes are present can be saved even if 2271 // the post is not dirty. Currently this restriction is imposed at UI, but 2272 // should be moved here. 2273 // 2274 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) 2275 // See: <PostSavedState /> (`forceIsDirty` prop) 2276 // See: <PostPublishButton /> (`forceIsDirty` prop) 2277 // See: https://github.com/WordPress/gutenberg/pull/4184 2278 2279 2280 return !!selectors_getEditedPostAttribute(state, 'title') || !!selectors_getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_["Platform"].OS === 'native'; 2281 } 2282 /** 2283 * Returns true if the edited post has content. A post has content if it has at 2284 * least one saveable block or otherwise has a non-empty content property 2285 * assigned. 2286 * 2287 * @param {Object} state Global application state. 2288 * 2289 * @return {boolean} Whether post has content. 2290 */ 2291 2292 function isEditedPostEmpty(state) { 2293 // While the condition of truthy content string is sufficient to determine 2294 // emptiness, testing saveable blocks length is a trivial operation. Since 2295 // this function can be called frequently, optimize for the fast case as a 2296 // condition of the mere existence of blocks. Note that the value of edited 2297 // content takes precedent over block content, and must fall through to the 2298 // default logic. 2299 const blocks = getEditorBlocks(state); 2300 2301 if (blocks.length) { 2302 // Pierce the abstraction of the serializer in knowing that blocks are 2303 // joined with with newlines such that even if every individual block 2304 // produces an empty save result, the serialized content is non-empty. 2305 if (blocks.length > 1) { 2306 return false; 2307 } // There are two conditions under which the optimization cannot be 2308 // assumed, and a fallthrough to getEditedPostContent must occur: 2309 // 2310 // 1. getBlocksForSerialization has special treatment in omitting a 2311 // single unmodified default block. 2312 // 2. Comment delimiters are omitted for a freeform or unregistered 2313 // block in its serialization. The freeform block specifically may 2314 // produce an empty string in its saved output. 2315 // 2316 // For all other content, the single block is assumed to make a post 2317 // non-empty, if only by virtue of its own comment delimiters. 2318 2319 2320 const blockName = blocks[0].name; 2321 2322 if (blockName !== Object(external_wp_blocks_["getDefaultBlockName"])() && blockName !== Object(external_wp_blocks_["getFreeformContentHandlerName"])()) { 2323 return false; 2324 } 2325 } 2326 2327 return !getEditedPostContent(state); 2328 } 2329 /** 2330 * Returns true if the post can be autosaved, or false otherwise. 2331 * 2332 * @param {Object} state Global application state. 2333 * @param {Object} autosave A raw autosave object from the REST API. 2334 * 2335 * @return {boolean} Whether the post can be autosaved. 2336 */ 2337 2338 const selectors_isEditedPostAutosaveable = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2339 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. 2340 if (!selectors_isEditedPostSaveable(state)) { 2341 return false; 2342 } // A post is not autosavable when there is a post autosave lock. 2343 2344 2345 if (isPostAutosavingLocked(state)) { 2346 return false; 2347 } 2348 2349 const postType = selectors_getCurrentPostType(state); 2350 const postId = selectors_getCurrentPostId(state); 2351 const hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId); 2352 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave 2353 // via a resolver, moving below the return would result in the autosave never 2354 // being fetched. 2355 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 2356 2357 const autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is 2358 // unable to determine if the post is autosaveable, so return false. 2359 2360 if (!hasFetchedAutosave) { 2361 return false; 2362 } // If we don't already have an autosave, the post is autosaveable. 2363 2364 2365 if (!autosave) { 2366 return true; 2367 } // To avoid an expensive content serialization, use the content dirtiness 2368 // flag in place of content field comparison against the known autosave. 2369 // This is not strictly accurate, and relies on a tolerance toward autosave 2370 // request failures for unnecessary saves. 2371 2372 2373 if (hasChangedContent(state)) { 2374 return true; 2375 } // If the title or excerpt has changed, the post is autosaveable. 2376 2377 2378 return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field)); 2379 }); 2380 /** 2381 * Returns the current autosave, or null if one is not set (i.e. if the post 2382 * has yet to be autosaved, or has been saved or published since the last 2383 * autosave). 2384 * 2385 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` 2386 * selector from the '@wordpress/core-data' package. 2387 * 2388 * @param {Object} state Editor state. 2389 * 2390 * @return {?Object} Current autosave, if exists. 2391 */ 2392 2393 const getAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2394 external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getAutosave()`", { 2395 since: '5.3', 2396 alternative: "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`" 2397 }); 2398 const postType = selectors_getCurrentPostType(state); 2399 const postId = selectors_getCurrentPostId(state); 2400 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); 2401 const autosave = select('core').getAutosave(postType, postId, currentUserId); 2402 return Object(external_lodash_["mapValues"])(Object(external_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue); 2403 }); 2404 /** 2405 * Returns the true if there is an existing autosave, otherwise false. 2406 * 2407 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector 2408 * from the '@wordpress/core-data' package and check for a truthy value. 2409 * 2410 * @param {Object} state Global application state. 2411 * 2412 * @return {boolean} Whether there is an existing autosave. 2413 */ 2414 2415 const hasAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2416 external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).hasAutosave()`", { 2417 since: '5.3', 2418 alternative: "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`" 2419 }); 2420 const postType = selectors_getCurrentPostType(state); 2421 const postId = selectors_getCurrentPostId(state); 2422 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); 2423 return !!select('core').getAutosave(postType, postId, currentUserId); 2424 }); 2425 /** 2426 * Return true if the post being edited is being scheduled. Preferring the 2427 * unsaved status values. 2428 * 2429 * @param {Object} state Global application state. 2430 * 2431 * @return {boolean} Whether the post has been published. 2432 */ 2433 2434 function selectors_isEditedPostBeingScheduled(state) { 2435 const date = selectors_getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency) 2436 2437 const checkedDate = new Date(Number(Object(external_wp_date_["getDate"])(date)) - ONE_MINUTE_IN_MS); 2438 return Object(external_wp_date_["isInTheFuture"])(checkedDate); 2439 } 2440 /** 2441 * Returns whether the current post should be considered to have a "floating" 2442 * date (i.e. that it would publish "Immediately" rather than at a set time). 2443 * 2444 * Unlike in the PHP backend, the REST API returns a full date string for posts 2445 * where the 0000-00-00T00:00:00 placeholder is present in the database. To 2446 * infer that a post is set to publish "Immediately" we check whether the date 2447 * and modified date are the same. 2448 * 2449 * @param {Object} state Editor state. 2450 * 2451 * @return {boolean} Whether the edited post has a floating date value. 2452 */ 2453 2454 function isEditedPostDateFloating(state) { 2455 const date = selectors_getEditedPostAttribute(state, 'date'); 2456 const modified = selectors_getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post 2457 // It shouldn't use the "edited" status otherwise it breaks the 2458 // infered post data floating status 2459 // See https://github.com/WordPress/gutenberg/issues/28083 2460 2461 const status = selectors_getCurrentPost(state).status; 2462 2463 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { 2464 return date === modified || date === null; 2465 } 2466 2467 return false; 2468 } 2469 /** 2470 * Returns true if the post is currently being saved, or false otherwise. 2471 * 2472 * @param {Object} state Global application state. 2473 * 2474 * @return {boolean} Whether post is being saved. 2475 */ 2476 2477 const selectors_isSavingPost = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2478 const postType = selectors_getCurrentPostType(state); 2479 const postId = selectors_getCurrentPostId(state); 2480 return select('core').isSavingEntityRecord('postType', postType, postId); 2481 }); 2482 /** 2483 * Returns true if a previous post save was attempted successfully, or false 2484 * otherwise. 2485 * 2486 * @param {Object} state Global application state. 2487 * 2488 * @return {boolean} Whether the post was saved successfully. 2489 */ 2490 2491 const didPostSaveRequestSucceed = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2492 const postType = selectors_getCurrentPostType(state); 2493 const postId = selectors_getCurrentPostId(state); 2494 return !select('core').getLastEntitySaveError('postType', postType, postId); 2495 }); 2496 /** 2497 * Returns true if a previous post save was attempted but failed, or false 2498 * otherwise. 2499 * 2500 * @param {Object} state Global application state. 2501 * 2502 * @return {boolean} Whether the post save failed. 2503 */ 2504 2505 const didPostSaveRequestFail = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2506 const postType = selectors_getCurrentPostType(state); 2507 const postId = selectors_getCurrentPostId(state); 2508 return !!select('core').getLastEntitySaveError('postType', postType, postId); 2509 }); 2510 /** 2511 * Returns true if the post is autosaving, or false otherwise. 2512 * 2513 * @param {Object} state Global application state. 2514 * 2515 * @return {boolean} Whether the post is autosaving. 2516 */ 2517 2518 function selectors_isAutosavingPost(state) { 2519 if (!selectors_isSavingPost(state)) { 2520 return false; 2521 } 2522 2523 return !!Object(external_lodash_["get"])(state.saving, ['options', 'isAutosave']); 2524 } 2525 /** 2526 * Returns true if the post is being previewed, or false otherwise. 2527 * 2528 * @param {Object} state Global application state. 2529 * 2530 * @return {boolean} Whether the post is being previewed. 2531 */ 2532 2533 function isPreviewingPost(state) { 2534 if (!selectors_isSavingPost(state)) { 2535 return false; 2536 } 2537 2538 return !!state.saving.options.isPreview; 2539 } 2540 /** 2541 * Returns the post preview link 2542 * 2543 * @param {Object} state Global application state. 2544 * 2545 * @return {string?} Preview Link. 2546 */ 2547 2548 function selectors_getEditedPostPreviewLink(state) { 2549 if (state.saving.pending || selectors_isSavingPost(state)) { 2550 return; 2551 } 2552 2553 let previewLink = getAutosaveAttribute(state, 'preview_link'); 2554 2555 if (!previewLink) { 2556 previewLink = selectors_getEditedPostAttribute(state, 'link'); 2557 2558 if (previewLink) { 2559 previewLink = Object(external_wp_url_["addQueryArgs"])(previewLink, { 2560 preview: true 2561 }); 2562 } 2563 } 2564 2565 const featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media'); 2566 2567 if (previewLink && featuredImageId) { 2568 return Object(external_wp_url_["addQueryArgs"])(previewLink, { 2569 _thumbnail_id: featuredImageId 2570 }); 2571 } 2572 2573 return previewLink; 2574 } 2575 /** 2576 * Returns a suggested post format for the current post, inferred only if there 2577 * is a single block within the post and it is of a type known to match a 2578 * default post format. Returns null if the format cannot be determined. 2579 * 2580 * @param {Object} state Global application state. 2581 * 2582 * @return {?string} Suggested post format. 2583 */ 2584 2585 function selectors_getSuggestedPostFormat(state) { 2586 const blocks = getEditorBlocks(state); 2587 if (blocks.length > 2) return null; 2588 let name; // If there is only one block in the content of the post grab its name 2589 // so we can derive a suitable post format from it. 2590 2591 if (blocks.length === 1) { 2592 name = blocks[0].name; // check for core/embed `video` and `audio` eligible suggestions 2593 2594 if (name === 'core/embed') { 2595 var _blocks$0$attributes; 2596 2597 const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug; 2598 2599 if (['youtube', 'vimeo'].includes(provider)) { 2600 name = 'core/video'; 2601 } else if (['spotify', 'soundcloud'].includes(provider)) { 2602 name = 'core/audio'; 2603 } 2604 } 2605 } // If there are two blocks in the content and the last one is a text blocks 2606 // grab the name of the first one to also suggest a post format from it. 2607 2608 2609 if (blocks.length === 2 && blocks[1].name === 'core/paragraph') { 2610 name = blocks[0].name; 2611 } // We only convert to default post formats in core. 2612 2613 2614 switch (name) { 2615 case 'core/image': 2616 return 'image'; 2617 2618 case 'core/quote': 2619 case 'core/pullquote': 2620 return 'quote'; 2621 2622 case 'core/gallery': 2623 return 'gallery'; 2624 2625 case 'core/video': 2626 return 'video'; 2627 2628 case 'core/audio': 2629 return 'audio'; 2630 2631 default: 2632 return null; 2633 } 2634 } 2635 /** 2636 * Returns a set of blocks which are to be used in consideration of the post's 2637 * generated save content. 2638 * 2639 * @deprecated since Gutenberg 6.2.0. 2640 * 2641 * @param {Object} state Editor state. 2642 * 2643 * @return {WPBlock[]} Filtered set of blocks for save. 2644 */ 2645 2646 function getBlocksForSerialization(state) { 2647 external_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', { 2648 since: '5.3', 2649 alternative: 'getEditorBlocks', 2650 hint: 'Blocks serialization pre-processing occurs at save time' 2651 }); 2652 const blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified 2653 // against the implementation of isEditedPostEmpty, which bypasses this 2654 // function for performance' sake, in an assumption of this current logic 2655 // being irrelevant to the optimized condition of emptiness. 2656 // A single unmodified default block is assumed to be equivalent to an 2657 // empty post. 2658 2659 const isSingleUnmodifiedDefaultBlock = blocks.length === 1 && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[0]); 2660 2661 if (isSingleUnmodifiedDefaultBlock) { 2662 return []; 2663 } 2664 2665 return blocks; 2666 } 2667 /** 2668 * Returns the content of the post being edited. 2669 * 2670 * @param {Object} state Global application state. 2671 * 2672 * @return {string} Post content. 2673 */ 2674 2675 const getEditedPostContent = Object(external_wp_data_["createRegistrySelector"])(select => state => { 2676 const postId = selectors_getCurrentPostId(state); 2677 const postType = selectors_getCurrentPostType(state); 2678 const record = select('core').getEditedEntityRecord('postType', postType, postId); 2679 2680 if (record) { 2681 if (typeof record.content === 'function') { 2682 return record.content(record); 2683 } else if (record.blocks) { 2684 return Object(external_wp_blocks_["__unstableSerializeAndClean"])(record.blocks); 2685 } else if (record.content) { 2686 return record.content; 2687 } 2688 } 2689 2690 return ''; 2691 }); 2692 /** 2693 * Returns true if the post is being published, or false otherwise. 2694 * 2695 * @param {Object} state Global application state. 2696 * 2697 * @return {boolean} Whether post is being published. 2698 */ 2699 2700 function selectors_isPublishingPost(state) { 2701 return selectors_isSavingPost(state) && !selectors_isCurrentPostPublished(state) && selectors_getEditedPostAttribute(state, 'status') === 'publish'; 2702 } 2703 /** 2704 * Returns whether the permalink is editable or not. 2705 * 2706 * @param {Object} state Editor state. 2707 * 2708 * @return {boolean} Whether or not the permalink is editable. 2709 */ 2710 2711 function isPermalinkEditable(state) { 2712 const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); 2713 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 2714 } 2715 /** 2716 * Returns the permalink for the post. 2717 * 2718 * @param {Object} state Editor state. 2719 * 2720 * @return {?string} The permalink, or null if the post is not viewable. 2721 */ 2722 2723 function getPermalink(state) { 2724 const permalinkParts = getPermalinkParts(state); 2725 2726 if (!permalinkParts) { 2727 return null; 2728 } 2729 2730 const { 2731 prefix, 2732 postName, 2733 suffix 2734 } = permalinkParts; 2735 2736 if (isPermalinkEditable(state)) { 2737 return prefix + postName + suffix; 2738 } 2739 2740 return prefix; 2741 } 2742 /** 2743 * Returns the slug for the post being edited, preferring a manually edited 2744 * value if one exists, then a sanitized version of the current post title, and 2745 * finally the post ID. 2746 * 2747 * @param {Object} state Editor state. 2748 * 2749 * @return {string} The current slug to be displayed in the editor 2750 */ 2751 2752 function getEditedPostSlug(state) { 2753 return selectors_getEditedPostAttribute(state, 'slug') || cleanForSlug(selectors_getEditedPostAttribute(state, 'title')) || selectors_getCurrentPostId(state); 2754 } 2755 /** 2756 * Returns the permalink for a post, split into it's three parts: the prefix, 2757 * the postName, and the suffix. 2758 * 2759 * @param {Object} state Editor state. 2760 * 2761 * @return {Object} An object containing the prefix, postName, and suffix for 2762 * the permalink, or null if the post is not viewable. 2763 */ 2764 2765 function getPermalinkParts(state) { 2766 const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); 2767 2768 if (!permalinkTemplate) { 2769 return null; 2770 } 2771 2772 const postName = selectors_getEditedPostAttribute(state, 'slug') || selectors_getEditedPostAttribute(state, 'generated_slug'); 2773 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); 2774 return { 2775 prefix, 2776 postName, 2777 suffix 2778 }; 2779 } 2780 /** 2781 * Returns whether the post is locked. 2782 * 2783 * @param {Object} state Global application state. 2784 * 2785 * @return {boolean} Is locked. 2786 */ 2787 2788 function selectors_isPostLocked(state) { 2789 return state.postLock.isLocked; 2790 } 2791 /** 2792 * Returns whether post saving is locked. 2793 * 2794 * @param {Object} state Global application state. 2795 * 2796 * @return {boolean} Is locked. 2797 */ 2798 2799 function selectors_isPostSavingLocked(state) { 2800 return Object.keys(state.postSavingLock).length > 0; 2801 } 2802 /** 2803 * Returns whether post autosaving is locked. 2804 * 2805 * @param {Object} state Global application state. 2806 * 2807 * @return {boolean} Is locked. 2808 */ 2809 2810 function isPostAutosavingLocked(state) { 2811 return Object.keys(state.postAutosavingLock).length > 0; 2812 } 2813 /** 2814 * Returns whether the edition of the post has been taken over. 2815 * 2816 * @param {Object} state Global application state. 2817 * 2818 * @return {boolean} Is post lock takeover. 2819 */ 2820 2821 function isPostLockTakeover(state) { 2822 return state.postLock.isTakeover; 2823 } 2824 /** 2825 * Returns details about the post lock user. 2826 * 2827 * @param {Object} state Global application state. 2828 * 2829 * @return {Object} A user object. 2830 */ 2831 2832 function getPostLockUser(state) { 2833 return state.postLock.user; 2834 } 2835 /** 2836 * Returns the active post lock. 2837 * 2838 * @param {Object} state Global application state. 2839 * 2840 * @return {Object} The lock object. 2841 */ 2842 2843 function getActivePostLock(state) { 2844 return state.postLock.activePostLock; 2845 } 2846 /** 2847 * Returns whether or not the user has the unfiltered_html capability. 2848 * 2849 * @param {Object} state Editor state. 2850 * 2851 * @return {boolean} Whether the user can or can't post unfiltered HTML. 2852 */ 2853 2854 function selectors_canUserUseUnfilteredHTML(state) { 2855 return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); 2856 } 2857 /** 2858 * Returns whether the pre-publish panel should be shown 2859 * or skipped when the user clicks the "publish" button. 2860 * 2861 * @param {Object} state Global application state. 2862 * 2863 * @return {boolean} Whether the pre-publish panel should be shown or not. 2864 */ 2865 2866 function selectors_isPublishSidebarEnabled(state) { 2867 if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) { 2868 return state.preferences.isPublishSidebarEnabled; 2869 } 2870 2871 return PREFERENCES_DEFAULTS.isPublishSidebarEnabled; 2872 } 2873 /** 2874 * Return the current block list. 2875 * 2876 * @param {Object} state 2877 * @return {Array} Block list. 2878 */ 2879 2880 function getEditorBlocks(state) { 2881 return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY; 2882 } 2883 /** 2884 * A block selection object. 2885 * 2886 * @typedef {Object} WPBlockSelection 2887 * 2888 * @property {string} clientId A block client ID. 2889 * @property {string} attributeKey A block attribute key. 2890 * @property {number} offset An attribute value offset, based on the rich 2891 * text value. See `wp.richText.create`. 2892 */ 2893 2894 /** 2895 * Returns the current selection start. 2896 * 2897 * @param {Object} state 2898 * @return {WPBlockSelection} The selection start. 2899 * 2900 * @deprecated since Gutenberg 10.0.0. 2901 */ 2902 2903 function getEditorSelectionStart(state) { 2904 var _getEditedPostAttribu; 2905 2906 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 2907 since: '10.0', 2908 plugin: 'Gutenberg', 2909 alternative: "select('core/editor').getEditorSelection" 2910 }); 2911 return (_getEditedPostAttribu = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart; 2912 } 2913 /** 2914 * Returns the current selection end. 2915 * 2916 * @param {Object} state 2917 * @return {WPBlockSelection} The selection end. 2918 * 2919 * @deprecated since Gutenberg 10.0.0. 2920 */ 2921 2922 function getEditorSelectionEnd(state) { 2923 var _getEditedPostAttribu2; 2924 2925 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 2926 since: '10.0', 2927 plugin: 'Gutenberg', 2928 alternative: "select('core/editor').getEditorSelection" 2929 }); 2930 return (_getEditedPostAttribu2 = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd; 2931 } 2932 /** 2933 * Returns the current selection. 2934 * 2935 * @param {Object} state 2936 * @return {WPBlockSelection} The selection end. 2937 */ 2938 2939 function selectors_getEditorSelection(state) { 2940 return selectors_getEditedPostAttribute(state, 'selection'); 2941 } 2942 /** 2943 * Is the editor ready 2944 * 2945 * @param {Object} state 2946 * @return {boolean} is Ready. 2947 */ 2948 2949 function selectors_unstableIsEditorReady(state) { 2950 return state.isReady; 2951 } 2952 /** 2953 * Returns the post editor settings. 2954 * 2955 * @param {Object} state Editor state. 2956 * 2957 * @return {Object} The editor settings object. 2958 */ 2959 2960 function selectors_getEditorSettings(state) { 2961 return state.editorSettings; 2962 } 2963 /* 2964 * Backward compatibility 2965 */ 2966 2967 /** 2968 * Returns state object prior to a specified optimist transaction ID, or `null` 2969 * if the transaction corresponding to the given ID cannot be found. 2970 * 2971 * @deprecated since Gutenberg 9.7.0. 2972 */ 2973 2974 function getStateBeforeOptimisticTransaction() { 2975 external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { 2976 since: '5.7', 2977 hint: 'No state history is kept on this store anymore' 2978 }); 2979 return null; 2980 } 2981 /** 2982 * Returns true if an optimistic transaction is pending commit, for which the 2983 * before state satisfies the given predicate function. 2984 * 2985 * @deprecated since Gutenberg 9.7.0. 2986 */ 2987 2988 function inSomeHistory() { 2989 external_wp_deprecated_default()("select('core/editor').inSomeHistory", { 2990 since: '5.7', 2991 hint: 'No state history is kept on this store anymore' 2992 }); 2993 return false; 2994 } 2995 2996 function getBlockEditorSelector(name) { 2997 return Object(external_wp_data_["createRegistrySelector"])(select => (state, ...args) => { 2998 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { 2999 since: '5.3', 3000 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`' 3001 }); 3002 return select('core/block-editor')[name](...args); 3003 }); 3004 } 3005 /** 3006 * @see getBlockName in core/block-editor store. 3007 */ 3008 3009 3010 const getBlockName = getBlockEditorSelector('getBlockName'); 3011 /** 3012 * @see isBlockValid in core/block-editor store. 3013 */ 3014 3015 const isBlockValid = getBlockEditorSelector('isBlockValid'); 3016 /** 3017 * @see getBlockAttributes in core/block-editor store. 3018 */ 3019 3020 const getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); 3021 /** 3022 * @see getBlock in core/block-editor store. 3023 */ 3024 3025 const getBlock = getBlockEditorSelector('getBlock'); 3026 /** 3027 * @see getBlocks in core/block-editor store. 3028 */ 3029 3030 const selectors_getBlocks = getBlockEditorSelector('getBlocks'); 3031 /** 3032 * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store. 3033 */ 3034 3035 const __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks'); 3036 /** 3037 * @see getClientIdsOfDescendants in core/block-editor store. 3038 */ 3039 3040 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); 3041 /** 3042 * @see getClientIdsWithDescendants in core/block-editor store. 3043 */ 3044 3045 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); 3046 /** 3047 * @see getGlobalBlockCount in core/block-editor store. 3048 */ 3049 3050 const selectors_getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); 3051 /** 3052 * @see getBlocksByClientId in core/block-editor store. 3053 */ 3054 3055 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); 3056 /** 3057 * @see getBlockCount in core/block-editor store. 3058 */ 3059 3060 const getBlockCount = getBlockEditorSelector('getBlockCount'); 3061 /** 3062 * @see getBlockSelectionStart in core/block-editor store. 3063 */ 3064 3065 const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); 3066 /** 3067 * @see getBlockSelectionEnd in core/block-editor store. 3068 */ 3069 3070 const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); 3071 /** 3072 * @see getSelectedBlockCount in core/block-editor store. 3073 */ 3074 3075 const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); 3076 /** 3077 * @see hasSelectedBlock in core/block-editor store. 3078 */ 3079 3080 const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); 3081 /** 3082 * @see getSelectedBlockClientId in core/block-editor store. 3083 */ 3084 3085 const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); 3086 /** 3087 * @see getSelectedBlock in core/block-editor store. 3088 */ 3089 3090 const getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); 3091 /** 3092 * @see getBlockRootClientId in core/block-editor store. 3093 */ 3094 3095 const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); 3096 /** 3097 * @see getBlockHierarchyRootClientId in core/block-editor store. 3098 */ 3099 3100 const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); 3101 /** 3102 * @see getAdjacentBlockClientId in core/block-editor store. 3103 */ 3104 3105 const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); 3106 /** 3107 * @see getPreviousBlockClientId in core/block-editor store. 3108 */ 3109 3110 const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); 3111 /** 3112 * @see getNextBlockClientId in core/block-editor store. 3113 */ 3114 3115 const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); 3116 /** 3117 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. 3118 */ 3119 3120 const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); 3121 /** 3122 * @see getMultiSelectedBlockClientIds in core/block-editor store. 3123 */ 3124 3125 const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); 3126 /** 3127 * @see getMultiSelectedBlocks in core/block-editor store. 3128 */ 3129 3130 const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); 3131 /** 3132 * @see getFirstMultiSelectedBlockClientId in core/block-editor store. 3133 */ 3134 3135 const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); 3136 /** 3137 * @see getLastMultiSelectedBlockClientId in core/block-editor store. 3138 */ 3139 3140 const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); 3141 /** 3142 * @see isFirstMultiSelectedBlock in core/block-editor store. 3143 */ 3144 3145 const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); 3146 /** 3147 * @see isBlockMultiSelected in core/block-editor store. 3148 */ 3149 3150 const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); 3151 /** 3152 * @see isAncestorMultiSelected in core/block-editor store. 3153 */ 3154 3155 const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); 3156 /** 3157 * @see getMultiSelectedBlocksStartClientId in core/block-editor store. 3158 */ 3159 3160 const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); 3161 /** 3162 * @see getMultiSelectedBlocksEndClientId in core/block-editor store. 3163 */ 3164 3165 const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); 3166 /** 3167 * @see getBlockOrder in core/block-editor store. 3168 */ 3169 3170 const getBlockOrder = getBlockEditorSelector('getBlockOrder'); 3171 /** 3172 * @see getBlockIndex in core/block-editor store. 3173 */ 3174 3175 const getBlockIndex = getBlockEditorSelector('getBlockIndex'); 3176 /** 3177 * @see isBlockSelected in core/block-editor store. 3178 */ 3179 3180 const isBlockSelected = getBlockEditorSelector('isBlockSelected'); 3181 /** 3182 * @see hasSelectedInnerBlock in core/block-editor store. 3183 */ 3184 3185 const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); 3186 /** 3187 * @see isBlockWithinSelection in core/block-editor store. 3188 */ 3189 3190 const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); 3191 /** 3192 * @see hasMultiSelection in core/block-editor store. 3193 */ 3194 3195 const hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); 3196 /** 3197 * @see isMultiSelecting in core/block-editor store. 3198 */ 3199 3200 const isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); 3201 /** 3202 * @see isSelectionEnabled in core/block-editor store. 3203 */ 3204 3205 const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); 3206 /** 3207 * @see getBlockMode in core/block-editor store. 3208 */ 3209 3210 const getBlockMode = getBlockEditorSelector('getBlockMode'); 3211 /** 3212 * @see isTyping in core/block-editor store. 3213 */ 3214 3215 const isTyping = getBlockEditorSelector('isTyping'); 3216 /** 3217 * @see isCaretWithinFormattedText in core/block-editor store. 3218 */ 3219 3220 const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); 3221 /** 3222 * @see getBlockInsertionPoint in core/block-editor store. 3223 */ 3224 3225 const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); 3226 /** 3227 * @see isBlockInsertionPointVisible in core/block-editor store. 3228 */ 3229 3230 const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); 3231 /** 3232 * @see isValidTemplate in core/block-editor store. 3233 */ 3234 3235 const isValidTemplate = getBlockEditorSelector('isValidTemplate'); 3236 /** 3237 * @see getTemplate in core/block-editor store. 3238 */ 3239 3240 const getTemplate = getBlockEditorSelector('getTemplate'); 3241 /** 3242 * @see getTemplateLock in core/block-editor store. 3243 */ 3244 3245 const getTemplateLock = getBlockEditorSelector('getTemplateLock'); 3246 /** 3247 * @see canInsertBlockType in core/block-editor store. 3248 */ 3249 3250 const canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); 3251 /** 3252 * @see getInserterItems in core/block-editor store. 3253 */ 3254 3255 const getInserterItems = getBlockEditorSelector('getInserterItems'); 3256 /** 3257 * @see hasInserterItems in core/block-editor store. 3258 */ 3259 3260 const hasInserterItems = getBlockEditorSelector('hasInserterItems'); 3261 /** 3262 * @see getBlockListSettings in core/block-editor store. 3263 */ 3264 3265 const getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); 3266 /** 3267 * Returns the default template types. 3268 * 3269 * @param {Object} state Global application state. 3270 * 3271 * @return {Object} The template types. 3272 */ 3273 3274 function __experimentalGetDefaultTemplateTypes(state) { 3275 var _getEditorSettings; 3276 3277 return (_getEditorSettings = selectors_getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes; 3278 } 3279 /** 3280 * Returns the default template part areas. 3281 * 3282 * @param {Object} state Global application state. 3283 * 3284 * @return {Array} The template part areas. 3285 */ 3286 3287 const __experimentalGetDefaultTemplatePartAreas = Object(rememo["a" /* default */])(state => { 3288 var _getEditorSettings2; 3289 3290 const areas = ((_getEditorSettings2 = selectors_getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || []; 3291 return areas === null || areas === void 0 ? void 0 : areas.map(item => { 3292 return { ...item, 3293 icon: getTemplatePartIcon(item.icon) 3294 }; 3295 }); 3296 }, state => { 3297 var _getEditorSettings3; 3298 3299 return [(_getEditorSettings3 = selectors_getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas]; 3300 }); 3301 /** 3302 * Returns a default template type searched by slug. 3303 * 3304 * @param {Object} state Global application state. 3305 * @param {string} slug The template type slug. 3306 * 3307 * @return {Object} The template type. 3308 */ 3309 3310 const __experimentalGetDefaultTemplateType = Object(rememo["a" /* default */])((state, slug) => Object(external_lodash_["find"])(__experimentalGetDefaultTemplateTypes(state), { 3311 slug 3312 }) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]); 3313 /** 3314 * Given a template entity, return information about it which is ready to be 3315 * rendered, such as the title, description, and icon. 3316 * 3317 * @param {Object} state Global application state. 3318 * @param {Object} template The template for which we need information. 3319 * @return {Object} Information about the template, including title, description, and icon. 3320 */ 3321 3322 function __experimentalGetTemplateInfo(state, template) { 3323 var _experimentalGetDefa; 3324 3325 if (!template) { 3326 return {}; 3327 } 3328 3329 const { 3330 excerpt, 3331 slug, 3332 title, 3333 area 3334 } = template; 3335 3336 const { 3337 title: defaultTitle, 3338 description: defaultDescription 3339 } = __experimentalGetDefaultTemplateType(state, slug); 3340 3341 const templateTitle = Object(external_lodash_["isString"])(title) ? title : title === null || title === void 0 ? void 0 : title.rendered; 3342 const templateDescription = Object(external_lodash_["isString"])(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw; 3343 const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || layout["a" /* default */]; 3344 return { 3345 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 3346 description: templateDescription || defaultDescription, 3347 icon: templateIcon 3348 }; 3349 } 3350 3351 // EXTERNAL MODULE: external ["wp","notices"] 3352 var external_wp_notices_ = __webpack_require__("onLe"); 3353 3354 // EXTERNAL MODULE: external ["wp","i18n"] 3355 var external_wp_i18n_ = __webpack_require__("l3Sj"); 3356 3357 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js 3358 /** 3359 * WordPress dependencies 3360 */ 3361 3362 /** 3363 * Internal dependencies 3364 */ 3365 3366 3367 /** 3368 * External dependencies 3369 */ 3370 3371 3372 /** 3373 * Builds the arguments for a success notification dispatch. 3374 * 3375 * @param {Object} data Incoming data to build the arguments from. 3376 * 3377 * @return {Array} Arguments for dispatch. An empty array signals no 3378 * notification should be sent. 3379 */ 3380 3381 function getNotificationArgumentsForSaveSuccess(data) { 3382 const { 3383 previousPost, 3384 post, 3385 postType 3386 } = data; // Autosaves are neither shown a notice nor redirected. 3387 3388 if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) { 3389 return []; 3390 } 3391 3392 const publishStatus = ['publish', 'private', 'future']; 3393 const isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status); 3394 const willPublish = Object(external_lodash_["includes"])(publishStatus, post.status); 3395 let noticeMessage; 3396 let shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false); 3397 3398 if (!isPublished && !willPublish) { 3399 // If saving a non-published post, don't show notice. 3400 noticeMessage = null; 3401 } else if (isPublished && !willPublish) { 3402 // If undoing publish status, show specific notice 3403 noticeMessage = postType.labels.item_reverted_to_draft; 3404 shouldShowLink = false; 3405 } else if (!isPublished && willPublish) { 3406 // If publishing or scheduling a post, show the corresponding 3407 // publish message 3408 noticeMessage = { 3409 publish: postType.labels.item_published, 3410 private: postType.labels.item_published_privately, 3411 future: postType.labels.item_scheduled 3412 }[post.status]; 3413 } else { 3414 // Generic fallback notice 3415 noticeMessage = postType.labels.item_updated; 3416 } 3417 3418 if (noticeMessage) { 3419 const actions = []; 3420 3421 if (shouldShowLink) { 3422 actions.push({ 3423 label: postType.labels.view_item, 3424 url: post.link 3425 }); 3426 } 3427 3428 return [noticeMessage, { 3429 id: SAVE_POST_NOTICE_ID, 3430 type: 'snackbar', 3431 actions 3432 }]; 3433 } 3434 3435 return []; 3436 } 3437 /** 3438 * Builds the fail notification arguments for dispatch. 3439 * 3440 * @param {Object} data Incoming data to build the arguments with. 3441 * 3442 * @return {Array} Arguments for dispatch. An empty array signals no 3443 * notification should be sent. 3444 */ 3445 3446 function getNotificationArgumentsForSaveFail(data) { 3447 const { 3448 post, 3449 edits, 3450 error 3451 } = data; 3452 3453 if (error && 'rest_autosave_no_changes' === error.code) { 3454 // Autosave requested a new autosave, but there were no changes. This shouldn't 3455 // result in an error notice for the user. 3456 return []; 3457 } 3458 3459 const publishStatus = ['publish', 'private', 'future']; 3460 const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message 3461 // Unless we publish an "updating failed" message 3462 3463 const messages = { 3464 publish: Object(external_wp_i18n_["__"])('Publishing failed.'), 3465 private: Object(external_wp_i18n_["__"])('Publishing failed.'), 3466 future: Object(external_wp_i18n_["__"])('Scheduling failed.') 3467 }; 3468 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only 3469 // supported as plaintext, and stripping the tags may muddle the meaning. 3470 3471 if (error.message && !/<\/?[^>]*>/.test(error.message)) { 3472 noticeMessage = [noticeMessage, error.message].join(' '); 3473 } 3474 3475 return [noticeMessage, { 3476 id: SAVE_POST_NOTICE_ID 3477 }]; 3478 } 3479 /** 3480 * Builds the trash fail notification arguments for dispatch. 3481 * 3482 * @param {Object} data 3483 * 3484 * @return {Array} Arguments for dispatch. 3485 */ 3486 3487 function getNotificationArgumentsForTrashFail(data) { 3488 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_wp_i18n_["__"])('Trashing failed'), { 3489 id: TRASH_POST_NOTICE_ID 3490 }]; 3491 } 3492 3493 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js 3494 /** 3495 * External dependencies 3496 */ 3497 3498 /** 3499 * WordPress dependencies 3500 */ 3501 3502 3503 3504 3505 3506 3507 /** 3508 * Internal dependencies 3509 */ 3510 3511 3512 3513 /** 3514 * Returns an action generator used in signalling that editor has initialized with 3515 * the specified post object and editor settings. 3516 * 3517 * @param {Object} post Post object. 3518 * @param {Object} edits Initial edited attributes object. 3519 * @param {Array?} template Block Template. 3520 */ 3521 3522 function* actions_setupEditor(post, edits, template) { 3523 // In order to ensure maximum of a single parse during setup, edits are 3524 // included as part of editor setup action. Assume edited content as 3525 // canonical if provided, falling back to post. 3526 let content; 3527 3528 if (Object(external_lodash_["has"])(edits, ['content'])) { 3529 content = edits.content; 3530 } else { 3531 content = post.content.raw; 3532 } 3533 3534 let blocks = Object(external_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists. 3535 3536 const isNewPost = post.status === 'auto-draft'; 3537 3538 if (isNewPost && template) { 3539 blocks = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); 3540 } 3541 3542 yield resetPost(post); 3543 yield { 3544 type: 'SETUP_EDITOR', 3545 post, 3546 edits, 3547 template 3548 }; 3549 yield actions_resetEditorBlocks(blocks, { 3550 __unstableShouldCreateUndoLevel: false 3551 }); 3552 yield setupEditorState(post); 3553 3554 if (edits && Object.keys(edits).some(key => edits[key] !== (Object(external_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]))) { 3555 yield actions_editPost(edits); 3556 } 3557 } 3558 /** 3559 * Returns an action object signalling that the editor is being destroyed and 3560 * that any necessary state or side-effect cleanup should occur. 3561 * 3562 * @return {Object} Action object. 3563 */ 3564 3565 function actions_experimentalTearDownEditor() { 3566 return { 3567 type: 'TEAR_DOWN_EDITOR' 3568 }; 3569 } 3570 /** 3571 * Returns an action object used in signalling that the latest version of the 3572 * post has been received, either by initialization or save. 3573 * 3574 * @param {Object} post Post object. 3575 * 3576 * @return {Object} Action object. 3577 */ 3578 3579 function resetPost(post) { 3580 return { 3581 type: 'RESET_POST', 3582 post 3583 }; 3584 } 3585 /** 3586 * Returns an action object used in signalling that the latest autosave of the 3587 * post has been received, by initialization or autosave. 3588 * 3589 * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )` 3590 * selector from the '@wordpress/core-data' package. 3591 * 3592 * @param {Object} newAutosave Autosave post object. 3593 * 3594 * @return {Object} Action object. 3595 */ 3596 3597 function* resetAutosave(newAutosave) { 3598 external_wp_deprecated_default()('resetAutosave action (`core/editor` store)', { 3599 since: '5.3', 3600 alternative: 'receiveAutosaves action (`core` store)' 3601 }); 3602 const postId = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostId'); 3603 yield external_wp_data_["controls"].dispatch('core', 'receiveAutosaves', postId, newAutosave); 3604 return { 3605 type: '__INERT__' 3606 }; 3607 } 3608 /** 3609 * Action for dispatching that a post update request has started. 3610 * 3611 * @param {Object} options 3612 * 3613 * @return {Object} An action object 3614 */ 3615 3616 function __experimentalRequestPostUpdateStart(options = {}) { 3617 return { 3618 type: 'REQUEST_POST_UPDATE_START', 3619 options 3620 }; 3621 } 3622 /** 3623 * Action for dispatching that a post update request has finished. 3624 * 3625 * @param {Object} options 3626 * 3627 * @return {Object} An action object 3628 */ 3629 3630 function __experimentalRequestPostUpdateFinish(options = {}) { 3631 return { 3632 type: 'REQUEST_POST_UPDATE_FINISH', 3633 options 3634 }; 3635 } 3636 /** 3637 * Returns an action object used in signalling that a patch of updates for the 3638 * latest version of the post have been received. 3639 * 3640 * @return {Object} Action object. 3641 * @deprecated since Gutenberg 9.7.0. 3642 */ 3643 3644 function updatePost() { 3645 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { 3646 since: '5.7', 3647 alternative: 'User the core entitires store instead' 3648 }); 3649 return { 3650 type: 'DO_NOTHING' 3651 }; 3652 } 3653 /** 3654 * Returns an action object used to setup the editor state when first opening 3655 * an editor. 3656 * 3657 * @param {Object} post Post object. 3658 * 3659 * @return {Object} Action object. 3660 */ 3661 3662 function setupEditorState(post) { 3663 return { 3664 type: 'SETUP_EDITOR_STATE', 3665 post 3666 }; 3667 } 3668 /** 3669 * Returns an action object used in signalling that attributes of the post have 3670 * been edited. 3671 * 3672 * @param {Object} edits Post attributes to edit. 3673 * @param {Object} options Options for the edit. 3674 * 3675 * @yield {Object} Action object or control. 3676 */ 3677 3678 function* actions_editPost(edits, options) { 3679 const { 3680 id, 3681 type 3682 } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 3683 yield external_wp_data_["controls"].dispatch('core', 'editEntityRecord', 'postType', type, id, edits, options); 3684 } 3685 /** 3686 * Action generator for saving the current post in the editor. 3687 * 3688 * @param {Object} options 3689 */ 3690 3691 function* actions_savePost(options = {}) { 3692 if (!(yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostSaveable'))) { 3693 return; 3694 } 3695 3696 let edits = { 3697 content: yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostContent') 3698 }; 3699 3700 if (!options.isAutosave) { 3701 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'editPost', edits, { 3702 undoIgnore: true 3703 }); 3704 } 3705 3706 yield __experimentalRequestPostUpdateStart(options); 3707 const previousRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 3708 edits = { 3709 id: previousRecord.id, 3710 ...(yield external_wp_data_["controls"].select('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)), 3711 ...edits 3712 }; 3713 yield external_wp_data_["controls"].dispatch('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options); 3714 yield __experimentalRequestPostUpdateFinish(options); 3715 const error = yield external_wp_data_["controls"].select('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id); 3716 3717 if (error) { 3718 const args = getNotificationArgumentsForSaveFail({ 3719 post: previousRecord, 3720 edits, 3721 error 3722 }); 3723 3724 if (args.length) { 3725 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...args); 3726 } 3727 } else { 3728 const updatedRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 3729 const args = getNotificationArgumentsForSaveSuccess({ 3730 previousPost: previousRecord, 3731 post: updatedRecord, 3732 postType: yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', updatedRecord.type), 3733 options 3734 }); 3735 3736 if (args.length) { 3737 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createSuccessNotice', ...args); 3738 } // Make sure that any edits after saving create an undo level and are 3739 // considered for change detection. 3740 3741 3742 if (!options.isAutosave) { 3743 yield external_wp_data_["controls"].dispatch('core/block-editor', '__unstableMarkLastChangeAsPersistent'); 3744 } 3745 } 3746 } 3747 /** 3748 * Action generator for handling refreshing the current post. 3749 */ 3750 3751 function* refreshPost() { 3752 const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 3753 const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType'); 3754 const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug); 3755 const newPost = yield Object(external_wp_dataControls_["apiFetch"])({ 3756 // Timestamp arg allows caller to bypass browser caching, which is 3757 // expected for this specific function. 3758 path: `/wp/v2/${postType.rest_base}/${post.id}` + `?context=edit&_timestamp=${Date.now()}` 3759 }); 3760 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'resetPost', newPost); 3761 } 3762 /** 3763 * Action generator for trashing the current post in the editor. 3764 */ 3765 3766 function* trashPost() { 3767 const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType'); 3768 const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug); 3769 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'removeNotice', TRASH_POST_NOTICE_ID); 3770 3771 try { 3772 const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 3773 yield Object(external_wp_dataControls_["apiFetch"])({ 3774 path: `/wp/v2/${postType.rest_base}/${post.id}`, 3775 method: 'DELETE' 3776 }); 3777 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost'); 3778 } catch (error) { 3779 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...getNotificationArgumentsForTrashFail({ 3780 error 3781 })); 3782 } 3783 } 3784 /** 3785 * Action generator used in signalling that the post should autosave. This 3786 * includes server-side autosaving (default) and client-side (a.k.a. local) 3787 * autosaving (e.g. on the Web, the post might be committed to Session 3788 * Storage). 3789 * 3790 * @param {Object?} options Extra flags to identify the autosave. 3791 */ 3792 3793 function* actions_autosave({ 3794 local = false, 3795 ...options 3796 } = {}) { 3797 if (local) { 3798 const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 3799 const isPostNew = yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostNew'); 3800 const title = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'title'); 3801 const content = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'content'); 3802 const excerpt = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'excerpt'); 3803 yield { 3804 type: 'LOCAL_AUTOSAVE_SET', 3805 postId: post.id, 3806 isPostNew, 3807 title, 3808 content, 3809 excerpt 3810 }; 3811 } else { 3812 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost', { 3813 isAutosave: true, 3814 ...options 3815 }); 3816 } 3817 } 3818 /** 3819 * Returns an action object used in signalling that undo history should 3820 * restore last popped state. 3821 * 3822 * @yield {Object} Action object. 3823 */ 3824 3825 function* actions_redo() { 3826 yield external_wp_data_["controls"].dispatch('core', 'redo'); 3827 } 3828 /** 3829 * Returns an action object used in signalling that undo history should pop. 3830 * 3831 * @yield {Object} Action object. 3832 */ 3833 3834 function* actions_undo() { 3835 yield external_wp_data_["controls"].dispatch('core', 'undo'); 3836 } 3837 /** 3838 * Returns an action object used in signalling that undo history record should 3839 * be created. 3840 * 3841 * @return {Object} Action object. 3842 */ 3843 3844 function createUndoLevel() { 3845 return { 3846 type: 'CREATE_UNDO_LEVEL' 3847 }; 3848 } 3849 /** 3850 * Returns an action object used to lock the editor. 3851 * 3852 * @param {Object} lock Details about the post lock status, user, and nonce. 3853 * 3854 * @return {Object} Action object. 3855 */ 3856 3857 function actions_updatePostLock(lock) { 3858 return { 3859 type: 'UPDATE_POST_LOCK', 3860 lock 3861 }; 3862 } 3863 /** 3864 * Returns an action object used in signalling that the user has enabled the 3865 * publish sidebar. 3866 * 3867 * @return {Object} Action object 3868 */ 3869 3870 function enablePublishSidebar() { 3871 return { 3872 type: 'ENABLE_PUBLISH_SIDEBAR' 3873 }; 3874 } 3875 /** 3876 * Returns an action object used in signalling that the user has disabled the 3877 * publish sidebar. 3878 * 3879 * @return {Object} Action object 3880 */ 3881 3882 function disablePublishSidebar() { 3883 return { 3884 type: 'DISABLE_PUBLISH_SIDEBAR' 3885 }; 3886 } 3887 /** 3888 * Returns an action object used to signal that post saving is locked. 3889 * 3890 * @param {string} lockName The lock name. 3891 * 3892 * @example 3893 * ``` 3894 * const { subscribe } = wp.data; 3895 * 3896 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 3897 * 3898 * // Only allow publishing posts that are set to a future date. 3899 * if ( 'publish' !== initialPostStatus ) { 3900 * 3901 * // Track locking. 3902 * let locked = false; 3903 * 3904 * // Watch for the publish event. 3905 * let unssubscribe = subscribe( () => { 3906 * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 3907 * if ( 'publish' !== currentPostStatus ) { 3908 * 3909 * // Compare the post date to the current date, lock the post if the date isn't in the future. 3910 * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); 3911 * const currentDate = new Date(); 3912 * if ( postDate.getTime() <= currentDate.getTime() ) { 3913 * if ( ! locked ) { 3914 * locked = true; 3915 * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); 3916 * } 3917 * } else { 3918 * if ( locked ) { 3919 * locked = false; 3920 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); 3921 * } 3922 * } 3923 * } 3924 * } ); 3925 * } 3926 * ``` 3927 * 3928 * @return {Object} Action object 3929 */ 3930 3931 function lockPostSaving(lockName) { 3932 return { 3933 type: 'LOCK_POST_SAVING', 3934 lockName 3935 }; 3936 } 3937 /** 3938 * Returns an action object used to signal that post saving is unlocked. 3939 * 3940 * @param {string} lockName The lock name. 3941 * 3942 * @example 3943 * ``` 3944 * // Unlock post saving with the lock key `mylock`: 3945 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); 3946 * ``` 3947 * 3948 * @return {Object} Action object 3949 */ 3950 3951 function unlockPostSaving(lockName) { 3952 return { 3953 type: 'UNLOCK_POST_SAVING', 3954 lockName 3955 }; 3956 } 3957 /** 3958 * Returns an action object used to signal that post autosaving is locked. 3959 * 3960 * @param {string} lockName The lock name. 3961 * 3962 * @example 3963 * ``` 3964 * // Lock post autosaving with the lock key `mylock`: 3965 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); 3966 * ``` 3967 * 3968 * @return {Object} Action object 3969 */ 3970 3971 function lockPostAutosaving(lockName) { 3972 return { 3973 type: 'LOCK_POST_AUTOSAVING', 3974 lockName 3975 }; 3976 } 3977 /** 3978 * Returns an action object used to signal that post autosaving is unlocked. 3979 * 3980 * @param {string} lockName The lock name. 3981 * 3982 * @example 3983 * ``` 3984 * // Unlock post saving with the lock key `mylock`: 3985 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); 3986 * ``` 3987 * 3988 * @return {Object} Action object 3989 */ 3990 3991 function unlockPostAutosaving(lockName) { 3992 return { 3993 type: 'UNLOCK_POST_AUTOSAVING', 3994 lockName 3995 }; 3996 } 3997 /** 3998 * Returns an action object used to signal that the blocks have been updated. 3999 * 4000 * @param {Array} blocks Block Array. 4001 * @param {?Object} options Optional options. 4002 * 4003 * @yield {Object} Action object 4004 */ 4005 4006 function* actions_resetEditorBlocks(blocks, options = {}) { 4007 const { 4008 __unstableShouldCreateUndoLevel, 4009 selection 4010 } = options; 4011 const edits = { 4012 blocks, 4013 selection 4014 }; 4015 4016 if (__unstableShouldCreateUndoLevel !== false) { 4017 const { 4018 id, 4019 type 4020 } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); 4021 const noChange = (yield external_wp_data_["controls"].select('core', 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks; 4022 4023 if (noChange) { 4024 return yield external_wp_data_["controls"].dispatch('core', '__unstableCreateUndoLevel', 'postType', type, id); 4025 } // We create a new function here on every persistent edit 4026 // to make sure the edit makes the post dirty and creates 4027 // a new undo level. 4028 4029 4030 edits.content = ({ 4031 blocks: blocksForSerialization = [] 4032 }) => Object(external_wp_blocks_["__unstableSerializeAndClean"])(blocksForSerialization); 4033 } 4034 4035 yield* actions_editPost(edits); 4036 } 4037 /* 4038 * Returns an action object used in signalling that the post editor settings have been updated. 4039 * 4040 * @param {Object} settings Updated settings 4041 * 4042 * @return {Object} Action object 4043 */ 4044 4045 function actions_updateEditorSettings(settings) { 4046 return { 4047 type: 'UPDATE_EDITOR_SETTINGS', 4048 settings 4049 }; 4050 } 4051 /** 4052 * Backward compatibility 4053 */ 4054 4055 const getBlockEditorAction = name => function* (...args) { 4056 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { 4057 since: '5.3', 4058 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`' 4059 }); 4060 yield external_wp_data_["controls"].dispatch('core/block-editor', name, ...args); 4061 }; 4062 /** 4063 * @see resetBlocks in core/block-editor store. 4064 */ 4065 4066 4067 const resetBlocks = getBlockEditorAction('resetBlocks'); 4068 /** 4069 * @see receiveBlocks in core/block-editor store. 4070 */ 4071 4072 const receiveBlocks = getBlockEditorAction('receiveBlocks'); 4073 /** 4074 * @see updateBlock in core/block-editor store. 4075 */ 4076 4077 const updateBlock = getBlockEditorAction('updateBlock'); 4078 /** 4079 * @see updateBlockAttributes in core/block-editor store. 4080 */ 4081 4082 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); 4083 /** 4084 * @see selectBlock in core/block-editor store. 4085 */ 4086 4087 const actions_selectBlock = getBlockEditorAction('selectBlock'); 4088 /** 4089 * @see startMultiSelect in core/block-editor store. 4090 */ 4091 4092 const startMultiSelect = getBlockEditorAction('startMultiSelect'); 4093 /** 4094 * @see stopMultiSelect in core/block-editor store. 4095 */ 4096 4097 const stopMultiSelect = getBlockEditorAction('stopMultiSelect'); 4098 /** 4099 * @see multiSelect in core/block-editor store. 4100 */ 4101 4102 const multiSelect = getBlockEditorAction('multiSelect'); 4103 /** 4104 * @see clearSelectedBlock in core/block-editor store. 4105 */ 4106 4107 const actions_clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); 4108 /** 4109 * @see toggleSelection in core/block-editor store. 4110 */ 4111 4112 const toggleSelection = getBlockEditorAction('toggleSelection'); 4113 /** 4114 * @see replaceBlocks in core/block-editor store. 4115 */ 4116 4117 const replaceBlocks = getBlockEditorAction('replaceBlocks'); 4118 /** 4119 * @see replaceBlock in core/block-editor store. 4120 */ 4121 4122 const replaceBlock = getBlockEditorAction('replaceBlock'); 4123 /** 4124 * @see moveBlocksDown in core/block-editor store. 4125 */ 4126 4127 const moveBlocksDown = getBlockEditorAction('moveBlocksDown'); 4128 /** 4129 * @see moveBlocksUp in core/block-editor store. 4130 */ 4131 4132 const moveBlocksUp = getBlockEditorAction('moveBlocksUp'); 4133 /** 4134 * @see moveBlockToPosition in core/block-editor store. 4135 */ 4136 4137 const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition'); 4138 /** 4139 * @see insertBlock in core/block-editor store. 4140 */ 4141 4142 const insertBlock = getBlockEditorAction('insertBlock'); 4143 /** 4144 * @see insertBlocks in core/block-editor store. 4145 */ 4146 4147 const actions_insertBlocks = getBlockEditorAction('insertBlocks'); 4148 /** 4149 * @see showInsertionPoint in core/block-editor store. 4150 */ 4151 4152 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); 4153 /** 4154 * @see hideInsertionPoint in core/block-editor store. 4155 */ 4156 4157 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); 4158 /** 4159 * @see setTemplateValidity in core/block-editor store. 4160 */ 4161 4162 const actions_setTemplateValidity = getBlockEditorAction('setTemplateValidity'); 4163 /** 4164 * @see synchronizeTemplate in core/block-editor store. 4165 */ 4166 4167 const actions_synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); 4168 /** 4169 * @see mergeBlocks in core/block-editor store. 4170 */ 4171 4172 const mergeBlocks = getBlockEditorAction('mergeBlocks'); 4173 /** 4174 * @see removeBlocks in core/block-editor store. 4175 */ 4176 4177 const removeBlocks = getBlockEditorAction('removeBlocks'); 4178 /** 4179 * @see removeBlock in core/block-editor store. 4180 */ 4181 4182 const removeBlock = getBlockEditorAction('removeBlock'); 4183 /** 4184 * @see toggleBlockMode in core/block-editor store. 4185 */ 4186 4187 const toggleBlockMode = getBlockEditorAction('toggleBlockMode'); 4188 /** 4189 * @see startTyping in core/block-editor store. 4190 */ 4191 4192 const startTyping = getBlockEditorAction('startTyping'); 4193 /** 4194 * @see stopTyping in core/block-editor store. 4195 */ 4196 4197 const stopTyping = getBlockEditorAction('stopTyping'); 4198 /** 4199 * @see enterFormattedText in core/block-editor store. 4200 */ 4201 4202 const enterFormattedText = getBlockEditorAction('enterFormattedText'); 4203 /** 4204 * @see exitFormattedText in core/block-editor store. 4205 */ 4206 4207 const exitFormattedText = getBlockEditorAction('exitFormattedText'); 4208 /** 4209 * @see insertDefaultBlock in core/block-editor store. 4210 */ 4211 4212 const actions_insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); 4213 /** 4214 * @see updateBlockListSettings in core/block-editor store. 4215 */ 4216 4217 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); 4218 4219 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js 4220 /** 4221 * Function returning a sessionStorage key to set or retrieve a given post's 4222 * automatic session backup. 4223 * 4224 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's 4225 * `loggedout` handler can clear sessionStorage of any user-private content. 4226 * 4227 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 4228 * 4229 * @param {string} postId Post ID. 4230 * @param {boolean} isPostNew Whether post new. 4231 * @return {string} sessionStorage key 4232 */ 4233 function postKey(postId, isPostNew) { 4234 return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`; 4235 } 4236 4237 function localAutosaveGet(postId, isPostNew) { 4238 return window.sessionStorage.getItem(postKey(postId, isPostNew)); 4239 } 4240 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { 4241 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ 4242 post_title: title, 4243 content, 4244 excerpt 4245 })); 4246 } 4247 function localAutosaveClear(postId, isPostNew) { 4248 window.sessionStorage.removeItem(postKey(postId, isPostNew)); 4249 } 4250 const controls = { 4251 LOCAL_AUTOSAVE_SET({ 4252 postId, 4253 isPostNew, 4254 title, 4255 content, 4256 excerpt 4257 }) { 4258 localAutosaveSet(postId, isPostNew, title, content, excerpt); 4259 } 4260 4261 }; 4262 /* harmony default export */ var store_controls = (controls); 4263 4264 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js 4265 /** 4266 * WordPress dependencies 4267 */ 4268 4269 4270 /** 4271 * Internal dependencies 4272 */ 4273 4274 4275 4276 4277 4278 4279 /** 4280 * Post editor data store configuration. 4281 * 4282 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore 4283 * 4284 * @type {Object} 4285 */ 4286 4287 const storeConfig = { 4288 reducer: reducer, 4289 selectors: selectors_namespaceObject, 4290 actions: actions_namespaceObject, 4291 controls: { ...external_wp_dataControls_["controls"], 4292 ...store_controls 4293 } 4294 }; 4295 /** 4296 * Store definition for the editor namespace. 4297 * 4298 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 4299 * 4300 * @type {Object} 4301 */ 4302 4303 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { ...storeConfig, 4304 persist: ['preferences'] 4305 }); // Once we build a more generic persistence plugin that works across types of stores 4306 // we'd be able to replace this with a register call. 4307 4308 Object(external_wp_data_["registerStore"])(STORE_NAME, { ...storeConfig, 4309 persist: ['preferences'] 4310 }); 4311 4312 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js 4313 4314 4315 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js 4316 /** 4317 * WordPress dependencies 4318 */ 4319 4320 4321 4322 /** 4323 * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected. 4324 * 4325 * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. 4326 * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as 4327 * the specific way of detecting changes. 4328 * 4329 * There are two caveats: 4330 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. 4331 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. 4332 */ 4333 4334 class autosave_monitor_AutosaveMonitor extends external_wp_element_["Component"] { 4335 constructor(props) { 4336 super(props); 4337 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); 4338 } 4339 4340 componentDidMount() { 4341 if (!this.props.disableIntervalChecks) { 4342 this.setAutosaveTimer(); 4343 } 4344 } 4345 4346 componentDidUpdate(prevProps) { 4347 if (this.props.disableIntervalChecks) { 4348 if (this.props.editsReference !== prevProps.editsReference) { 4349 this.props.autosave(); 4350 } 4351 4352 return; 4353 } 4354 4355 if (!this.props.isDirty) { 4356 this.needsAutosave = false; 4357 return; 4358 } 4359 4360 if (this.props.isAutosaving && !prevProps.isAutosaving) { 4361 this.needsAutosave = false; 4362 return; 4363 } 4364 4365 if (this.props.editsReference !== prevProps.editsReference) { 4366 this.needsAutosave = true; 4367 } 4368 } 4369 4370 componentWillUnmount() { 4371 clearTimeout(this.timerId); 4372 } 4373 4374 setAutosaveTimer(timeout = this.props.interval * 1000) { 4375 this.timerId = setTimeout(() => { 4376 this.autosaveTimerHandler(); 4377 }, timeout); 4378 } 4379 4380 autosaveTimerHandler() { 4381 if (!this.props.isAutosaveable) { 4382 this.setAutosaveTimer(1000); 4383 return; 4384 } 4385 4386 if (this.needsAutosave) { 4387 this.needsAutosave = false; 4388 this.props.autosave(); 4389 } 4390 4391 this.setAutosaveTimer(); 4392 } 4393 4394 render() { 4395 return null; 4396 } 4397 4398 } 4399 /* harmony default export */ var autosave_monitor = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, ownProps) => { 4400 const { 4401 getReferenceByDistinctEdits 4402 } = select('core'); 4403 const { 4404 isEditedPostDirty, 4405 isEditedPostAutosaveable, 4406 isAutosavingPost, 4407 getEditorSettings 4408 } = select('core/editor'); 4409 const { 4410 interval = getEditorSettings().autosaveInterval 4411 } = ownProps; 4412 return { 4413 editsReference: getReferenceByDistinctEdits(), 4414 isDirty: isEditedPostDirty(), 4415 isAutosaveable: isEditedPostAutosaveable(), 4416 isAutosaving: isAutosavingPost(), 4417 interval 4418 }; 4419 }), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => ({ 4420 autosave() { 4421 const { 4422 autosave = dispatch('core/editor').autosave 4423 } = ownProps; 4424 autosave(); 4425 } 4426 4427 }))])(autosave_monitor_AutosaveMonitor)); 4428 4429 // EXTERNAL MODULE: ./node_modules/classnames/index.js 4430 var classnames = __webpack_require__("TSYQ"); 4431 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 4432 4433 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js 4434 4435 4436 /** 4437 * External dependencies 4438 */ 4439 4440 4441 const TableOfContentsItem = ({ 4442 children, 4443 isValid, 4444 level, 4445 href, 4446 onSelect 4447 }) => Object(external_wp_element_["createElement"])("li", { 4448 className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, { 4449 'is-invalid': !isValid 4450 }) 4451 }, Object(external_wp_element_["createElement"])("a", { 4452 href: href, 4453 className: "document-outline__button", 4454 onClick: onSelect 4455 }, Object(external_wp_element_["createElement"])("span", { 4456 className: "document-outline__emdash", 4457 "aria-hidden": "true" 4458 }), Object(external_wp_element_["createElement"])("strong", { 4459 className: "document-outline__level" 4460 }, level), Object(external_wp_element_["createElement"])("span", { 4461 className: "document-outline__item-content" 4462 }, children))); 4463 4464 /* harmony default export */ var document_outline_item = (TableOfContentsItem); 4465 4466 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js 4467 4468 4469 /** 4470 * External dependencies 4471 */ 4472 4473 /** 4474 * WordPress dependencies 4475 */ 4476 4477 4478 4479 4480 4481 4482 /** 4483 * Internal dependencies 4484 */ 4485 4486 4487 /** 4488 * Module constants 4489 */ 4490 4491 const emptyHeadingContent = Object(external_wp_element_["createElement"])("em", null, Object(external_wp_i18n_["__"])('(Empty heading)')); 4492 const incorrectLevelContent = [Object(external_wp_element_["createElement"])("br", { 4493 key: "incorrect-break" 4494 }), Object(external_wp_element_["createElement"])("em", { 4495 key: "incorrect-message" 4496 }, Object(external_wp_i18n_["__"])('(Incorrect heading level)'))]; 4497 const singleH1Headings = [Object(external_wp_element_["createElement"])("br", { 4498 key: "incorrect-break-h1" 4499 }), Object(external_wp_element_["createElement"])("em", { 4500 key: "incorrect-message-h1" 4501 }, Object(external_wp_i18n_["__"])('(Your theme may already use a H1 for the post title)'))]; 4502 const multipleH1Headings = [Object(external_wp_element_["createElement"])("br", { 4503 key: "incorrect-break-multiple-h1" 4504 }), Object(external_wp_element_["createElement"])("em", { 4505 key: "incorrect-message-multiple-h1" 4506 }, Object(external_wp_i18n_["__"])('(Multiple H1 headings are not recommended)'))]; 4507 /** 4508 * Returns an array of heading blocks enhanced with the following properties: 4509 * level - An integer with the heading level. 4510 * isEmpty - Flag indicating if the heading has no content. 4511 * 4512 * @param {?Array} blocks An array of blocks. 4513 * 4514 * @return {Array} An array of heading blocks enhanced with the properties described above. 4515 */ 4516 4517 const computeOutlineHeadings = (blocks = []) => { 4518 return Object(external_lodash_["flatMap"])(blocks, (block = {}) => { 4519 if (block.name === 'core/heading') { 4520 return { ...block, 4521 level: block.attributes.level, 4522 isEmpty: isEmptyHeading(block) 4523 }; 4524 } 4525 4526 return computeOutlineHeadings(block.innerBlocks); 4527 }); 4528 }; 4529 4530 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0; 4531 4532 const DocumentOutline = ({ 4533 blocks = [], 4534 title, 4535 onSelect, 4536 isTitleSupported, 4537 hasOutlineItemsDisabled 4538 }) => { 4539 const headings = computeOutlineHeadings(blocks); 4540 4541 if (headings.length < 1) { 4542 return null; 4543 } 4544 4545 let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now. 4546 4547 const titleNode = document.querySelector('.editor-post-title__input'); 4548 const hasTitle = isTitleSupported && title && titleNode; 4549 const countByLevel = Object(external_lodash_["countBy"])(headings, 'level'); 4550 const hasMultipleH1 = countByLevel[1] > 1; 4551 return Object(external_wp_element_["createElement"])("div", { 4552 className: "document-outline" 4553 }, Object(external_wp_element_["createElement"])("ul", null, hasTitle && Object(external_wp_element_["createElement"])(document_outline_item, { 4554 level: Object(external_wp_i18n_["__"])('Title'), 4555 isValid: true, 4556 onSelect: onSelect, 4557 href: `#${titleNode.id}`, 4558 isDisabled: hasOutlineItemsDisabled 4559 }, title), headings.map((item, index) => { 4560 // Headings remain the same, go up by one, or down by any amount. 4561 // Otherwise there are missing levels. 4562 const isIncorrectLevel = item.level > prevHeadingLevel + 1; 4563 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); 4564 prevHeadingLevel = item.level; 4565 return Object(external_wp_element_["createElement"])(document_outline_item, { 4566 key: index, 4567 level: `H${item.level}`, 4568 isValid: isValid, 4569 isDisabled: hasOutlineItemsDisabled, 4570 href: `#block-${item.clientId}`, 4571 onSelect: onSelect 4572 }, item.isEmpty ? emptyHeadingContent : Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["create"])({ 4573 html: item.attributes.content 4574 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings); 4575 }))); 4576 }; 4577 /* harmony default export */ var document_outline = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => { 4578 const { 4579 getBlocks 4580 } = select(external_wp_blockEditor_["store"]); 4581 const { 4582 getEditedPostAttribute 4583 } = select('core/editor'); 4584 const { 4585 getPostType 4586 } = select('core'); 4587 const postType = getPostType(getEditedPostAttribute('type')); 4588 return { 4589 title: getEditedPostAttribute('title'), 4590 blocks: getBlocks(), 4591 isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false) 4592 }; 4593 }))(DocumentOutline)); 4594 4595 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js 4596 /** 4597 * External dependencies 4598 */ 4599 4600 /** 4601 * WordPress dependencies 4602 */ 4603 4604 4605 4606 4607 function DocumentOutlineCheck({ 4608 blocks, 4609 children 4610 }) { 4611 const headings = Object(external_lodash_["filter"])(blocks, block => block.name === 'core/heading'); 4612 4613 if (headings.length < 1) { 4614 return null; 4615 } 4616 4617 return children; 4618 } 4619 4620 /* harmony default export */ var check = (Object(external_wp_data_["withSelect"])(select => ({ 4621 blocks: select(external_wp_blockEditor_["store"]).getBlocks() 4622 }))(DocumentOutlineCheck)); 4623 4624 // EXTERNAL MODULE: external ["wp","keyboardShortcuts"] 4625 var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m"); 4626 4627 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js 4628 /** 4629 * WordPress dependencies 4630 */ 4631 4632 4633 4634 4635 function SaveShortcut({ 4636 resetBlocksOnSave 4637 }) { 4638 const { 4639 resetEditorBlocks, 4640 savePost 4641 } = Object(external_wp_data_["useDispatch"])('core/editor'); 4642 const { 4643 isEditedPostDirty, 4644 getPostEdits 4645 } = Object(external_wp_data_["useSelect"])(select => { 4646 const { 4647 isEditedPostDirty: _isEditedPostDirty, 4648 getPostEdits: _getPostEdits 4649 } = select('core/editor'); 4650 return { 4651 isEditedPostDirty: _isEditedPostDirty, 4652 getPostEdits: _getPostEdits 4653 }; 4654 }, []); 4655 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/save', event => { 4656 event.preventDefault(); // TODO: This should be handled in the `savePost` effect in 4657 // considering `isSaveable`. See note on `isEditedPostSaveable` 4658 // selector about dirtiness and meta-boxes. 4659 // 4660 // See: `isEditedPostSaveable` 4661 4662 if (!isEditedPostDirty()) { 4663 return; 4664 } // The text editor requires that editor blocks are updated for a 4665 // save to work correctly. Usually this happens when the textarea 4666 // for the code editors blurs, but the shortcut can be used without 4667 // blurring the textarea. 4668 4669 4670 if (resetBlocksOnSave) { 4671 const postEdits = getPostEdits(); 4672 4673 if (postEdits.content && typeof postEdits.content === 'string') { 4674 const blocks = Object(external_wp_blocks_["parse"])(postEdits.content); 4675 resetEditorBlocks(blocks); 4676 } 4677 } 4678 4679 savePost(); 4680 }, { 4681 bindGlobal: true 4682 }); 4683 return null; 4684 } 4685 4686 /* harmony default export */ var save_shortcut = (SaveShortcut); 4687 4688 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js 4689 4690 4691 /** 4692 * WordPress dependencies 4693 */ 4694 4695 4696 4697 /** 4698 * Internal dependencies 4699 */ 4700 4701 4702 4703 function VisualEditorGlobalKeyboardShortcuts() { 4704 const { 4705 redo, 4706 undo 4707 } = Object(external_wp_data_["useDispatch"])('core/editor'); 4708 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/undo', event => { 4709 undo(); 4710 event.preventDefault(); 4711 }, { 4712 bindGlobal: true 4713 }); 4714 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/redo', event => { 4715 redo(); 4716 event.preventDefault(); 4717 }, { 4718 bindGlobal: true 4719 }); 4720 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_wp_element_["createElement"])(save_shortcut, null)); 4721 } 4722 4723 /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts); 4724 4725 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js 4726 4727 4728 /** 4729 * Internal dependencies 4730 */ 4731 4732 function TextEditorGlobalKeyboardShortcuts() { 4733 return Object(external_wp_element_["createElement"])(save_shortcut, { 4734 resetBlocksOnSave: true 4735 }); 4736 } 4737 4738 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js 4739 4740 4741 /** 4742 * WordPress dependencies 4743 */ 4744 4745 4746 4747 4748 4749 4750 function EditorKeyboardShortcutsRegister() { 4751 // Registering the shortcuts 4752 const { 4753 registerShortcut 4754 } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]); 4755 Object(external_wp_element_["useEffect"])(() => { 4756 registerShortcut({ 4757 name: 'core/editor/save', 4758 category: 'global', 4759 description: Object(external_wp_i18n_["__"])('Save your changes.'), 4760 keyCombination: { 4761 modifier: 'primary', 4762 character: 's' 4763 } 4764 }); 4765 registerShortcut({ 4766 name: 'core/editor/undo', 4767 category: 'global', 4768 description: Object(external_wp_i18n_["__"])('Undo your last changes.'), 4769 keyCombination: { 4770 modifier: 'primary', 4771 character: 'z' 4772 } 4773 }); 4774 registerShortcut({ 4775 name: 'core/editor/redo', 4776 category: 'global', 4777 description: Object(external_wp_i18n_["__"])('Redo your last undo.'), 4778 keyCombination: { 4779 modifier: 'primaryShift', 4780 character: 'z' 4781 } 4782 }); 4783 }, [registerShortcut]); 4784 return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null); 4785 } 4786 4787 /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister); 4788 4789 // EXTERNAL MODULE: external ["wp","components"] 4790 var external_wp_components_ = __webpack_require__("tI+e"); 4791 4792 // EXTERNAL MODULE: external ["wp","keycodes"] 4793 var external_wp_keycodes_ = __webpack_require__("RxS6"); 4794 4795 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js 4796 var library_redo = __webpack_require__("K2cm"); 4797 4798 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js 4799 var library_undo = __webpack_require__("Ntru"); 4800 4801 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js 4802 4803 4804 4805 /** 4806 * WordPress dependencies 4807 */ 4808 4809 4810 4811 4812 4813 4814 /** 4815 * Internal dependencies 4816 */ 4817 4818 4819 4820 function EditorHistoryRedo(props, ref) { 4821 const hasRedo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorRedo(), []); 4822 const { 4823 redo 4824 } = Object(external_wp_data_["useDispatch"])(store); 4825 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { 4826 ref: ref, 4827 icon: !Object(external_wp_i18n_["isRTL"])() ? library_redo["a" /* default */] : library_undo["a" /* default */] 4828 /* translators: button label text should, if possible, be under 16 characters. */ 4829 , 4830 label: Object(external_wp_i18n_["__"])('Redo'), 4831 shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this 4832 // button, because it will remove focus for keyboard users. 4833 // See: https://github.com/WordPress/gutenberg/issues/3486 4834 , 4835 "aria-disabled": !hasRedo, 4836 onClick: hasRedo ? redo : undefined, 4837 className: "editor-history__redo" 4838 })); 4839 } 4840 4841 /* harmony default export */ var editor_history_redo = (Object(external_wp_element_["forwardRef"])(EditorHistoryRedo)); 4842 4843 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js 4844 4845 4846 4847 /** 4848 * WordPress dependencies 4849 */ 4850 4851 4852 4853 4854 4855 4856 /** 4857 * Internal dependencies 4858 */ 4859 4860 4861 4862 function EditorHistoryUndo(props, ref) { 4863 const hasUndo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorUndo(), []); 4864 const { 4865 undo 4866 } = Object(external_wp_data_["useDispatch"])(store); 4867 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { 4868 ref: ref, 4869 icon: !Object(external_wp_i18n_["isRTL"])() ? library_undo["a" /* default */] : library_redo["a" /* default */] 4870 /* translators: button label text should, if possible, be under 16 characters. */ 4871 , 4872 label: Object(external_wp_i18n_["__"])('Undo'), 4873 shortcut: external_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this 4874 // button, because it will remove focus for keyboard users. 4875 // See: https://github.com/WordPress/gutenberg/issues/3486 4876 , 4877 "aria-disabled": !hasUndo, 4878 onClick: hasUndo ? undo : undefined, 4879 className: "editor-history__undo" 4880 })); 4881 } 4882 4883 /* harmony default export */ var editor_history_undo = (Object(external_wp_element_["forwardRef"])(EditorHistoryUndo)); 4884 4885 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js 4886 4887 4888 /** 4889 * WordPress dependencies 4890 */ 4891 4892 4893 4894 4895 4896 4897 function TemplateValidationNotice({ 4898 isValid, 4899 ...props 4900 }) { 4901 if (isValid) { 4902 return null; 4903 } 4904 4905 const confirmSynchronization = () => { 4906 if ( // eslint-disable-next-line no-alert 4907 window.confirm(Object(external_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) { 4908 props.synchronizeTemplate(); 4909 } 4910 }; 4911 4912 return Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { 4913 className: "editor-template-validation-notice", 4914 isDismissible: false, 4915 status: "warning", 4916 actions: [{ 4917 label: Object(external_wp_i18n_["__"])('Keep it as is'), 4918 onClick: props.resetTemplateValidity 4919 }, { 4920 label: Object(external_wp_i18n_["__"])('Reset the template'), 4921 onClick: confirmSynchronization 4922 }] 4923 }, Object(external_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')); 4924 } 4925 4926 /* harmony default export */ var template_validation_notice = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({ 4927 isValid: select(external_wp_blockEditor_["store"]).isValidTemplate() 4928 })), Object(external_wp_data_["withDispatch"])(dispatch => { 4929 const { 4930 setTemplateValidity, 4931 synchronizeTemplate 4932 } = dispatch(external_wp_blockEditor_["store"]); 4933 return { 4934 resetTemplateValidity: () => setTemplateValidity(true), 4935 synchronizeTemplate 4936 }; 4937 })])(TemplateValidationNotice)); 4938 4939 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js 4940 4941 4942 /** 4943 * External dependencies 4944 */ 4945 4946 /** 4947 * WordPress dependencies 4948 */ 4949 4950 4951 4952 4953 4954 /** 4955 * Internal dependencies 4956 */ 4957 4958 4959 function EditorNotices({ 4960 notices, 4961 onRemove 4962 }) { 4963 const dismissibleNotices = Object(external_lodash_["filter"])(notices, { 4964 isDismissible: true, 4965 type: 'default' 4966 }); 4967 const nonDismissibleNotices = Object(external_lodash_["filter"])(notices, { 4968 isDismissible: false, 4969 type: 'default' 4970 }); 4971 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], { 4972 notices: nonDismissibleNotices, 4973 className: "components-editor-notices__pinned" 4974 }), Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], { 4975 notices: dismissibleNotices, 4976 className: "components-editor-notices__dismissible", 4977 onRemove: onRemove 4978 }, Object(external_wp_element_["createElement"])(template_validation_notice, null))); 4979 } 4980 /* harmony default export */ var editor_notices = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({ 4981 notices: select(external_wp_notices_["store"]).getNotices() 4982 })), Object(external_wp_data_["withDispatch"])(dispatch => ({ 4983 onRemove: dispatch(external_wp_notices_["store"]).removeNotice 4984 }))])(EditorNotices)); 4985 4986 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js 4987 4988 4989 /** 4990 * External dependencies 4991 */ 4992 4993 /** 4994 * WordPress dependencies 4995 */ 4996 4997 4998 4999 5000 function EditorSnackbars() { 5001 const notices = Object(external_wp_data_["useSelect"])(select => select(external_wp_notices_["store"]).getNotices(), []); 5002 const { 5003 removeNotice 5004 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); 5005 const snackbarNotices = Object(external_lodash_["filter"])(notices, { 5006 type: 'snackbar' 5007 }); 5008 return Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], { 5009 notices: snackbarNotices, 5010 className: "components-editor-notices__snackbar", 5011 onRemove: removeNotice 5012 }); 5013 } 5014 5015 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js 5016 var library_close = __webpack_require__("w95h"); 5017 5018 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js 5019 5020 5021 /** 5022 * WordPress dependencies 5023 */ 5024 5025 const page_page = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 5026 xmlns: "http://www.w3.org/2000/svg", 5027 viewBox: "0 0 24 24" 5028 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 5029 d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z" 5030 })); 5031 /* harmony default export */ var library_page = (page_page); 5032 5033 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js 5034 5035 5036 /** 5037 * WordPress dependencies 5038 */ 5039 5040 5041 5042 5043 5044 function EntityRecordItem({ 5045 record, 5046 checked, 5047 onChange, 5048 closePanel 5049 }) { 5050 const { 5051 name, 5052 kind, 5053 title, 5054 key 5055 } = record; 5056 const parentBlockId = Object(external_wp_data_["useSelect"])(select => { 5057 var _blocks$; 5058 5059 // Get entity's blocks. 5060 const { 5061 blocks = [] 5062 } = select('core').getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block. 5063 5064 const parents = select(external_wp_blockEditor_["store"]).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId. 5065 5066 return parents[parents.length - 1]; 5067 }, []); // Handle templates that might use default descriptive titles 5068 5069 const entityRecordTitle = Object(external_wp_data_["useSelect"])(select => { 5070 if ('postType' !== kind || 'wp_template' !== name) { 5071 return title; 5072 } 5073 5074 const template = select('core').getEditedEntityRecord(kind, name, key); 5075 return select('core/editor').__experimentalGetTemplateInfo(template).title; 5076 }, [name, kind, title, key]); 5077 const isSelected = Object(external_wp_data_["useSelect"])(select => { 5078 const selectedBlockId = select(external_wp_blockEditor_["store"]).getSelectedBlockClientId(); 5079 return selectedBlockId === parentBlockId; 5080 }, [parentBlockId]); 5081 const isSelectedText = isSelected ? Object(external_wp_i18n_["__"])('Selected') : Object(external_wp_i18n_["__"])('Select'); 5082 const { 5083 selectBlock 5084 } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); 5085 const selectParentBlock = Object(external_wp_element_["useCallback"])(() => selectBlock(parentBlockId), [parentBlockId]); 5086 const selectAndDismiss = Object(external_wp_element_["useCallback"])(() => { 5087 selectBlock(parentBlockId); 5088 closePanel(); 5089 }, [parentBlockId]); 5090 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 5091 label: Object(external_wp_element_["createElement"])("strong", null, entityRecordTitle || Object(external_wp_i18n_["__"])('Untitled')), 5092 checked: checked, 5093 onChange: onChange 5094 }), parentBlockId ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 5095 onClick: selectParentBlock, 5096 className: "entities-saved-states__find-entity", 5097 disabled: isSelected 5098 }, isSelectedText), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 5099 onClick: selectAndDismiss, 5100 className: "entities-saved-states__find-entity-small", 5101 disabled: isSelected 5102 }, isSelectedText)) : null); 5103 } 5104 5105 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js 5106 5107 5108 /** 5109 * External dependencies 5110 */ 5111 5112 /** 5113 * WordPress dependencies 5114 */ 5115 5116 5117 5118 5119 5120 /** 5121 * Internal dependencies 5122 */ 5123 5124 5125 const ENTITY_NAME_ICONS = { 5126 site: layout["a" /* default */], 5127 page: library_page 5128 }; 5129 function EntityTypeList({ 5130 list, 5131 unselectedEntities, 5132 setUnselectedEntities, 5133 closePanel 5134 }) { 5135 const firstRecord = list[0]; 5136 const entity = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntity(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); // Set icon based on type of entity. 5137 5138 const { 5139 name 5140 } = firstRecord; 5141 const icon = ENTITY_NAME_ICONS[name]; 5142 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 5143 title: entity.label, 5144 initialOpen: true, 5145 icon: icon 5146 }, list.map(record => { 5147 return Object(external_wp_element_["createElement"])(EntityRecordItem, { 5148 key: record.key || record.property, 5149 record: record, 5150 checked: !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), 5151 onChange: value => setUnselectedEntities(record, value), 5152 closePanel: closePanel 5153 }); 5154 })); 5155 } 5156 5157 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js 5158 5159 5160 5161 /** 5162 * External dependencies 5163 */ 5164 5165 /** 5166 * WordPress dependencies 5167 */ 5168 5169 5170 5171 5172 5173 5174 5175 5176 /** 5177 * Internal dependencies 5178 */ 5179 5180 5181 const TRANSLATED_SITE_PROTPERTIES = { 5182 title: Object(external_wp_i18n_["__"])('Title'), 5183 description: Object(external_wp_i18n_["__"])('Tagline'), 5184 site_logo: Object(external_wp_i18n_["__"])('Logo'), 5185 show_on_front: Object(external_wp_i18n_["__"])('Show on front'), 5186 page_on_front: Object(external_wp_i18n_["__"])('Page on front') 5187 }; 5188 function EntitiesSavedStates({ 5189 close 5190 }) { 5191 const saveButtonRef = Object(external_wp_element_["useRef"])(); 5192 const { 5193 dirtyEntityRecords 5194 } = Object(external_wp_data_["useSelect"])(select => { 5195 const dirtyRecords = select(external_wp_coreData_["store"]).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces. 5196 5197 5198 const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site')); 5199 const siteEdits = select(external_wp_coreData_["store"]).getEntityRecordEdits('root', 'site'); 5200 const siteEditsAsEntities = []; 5201 5202 for (const property in siteEdits) { 5203 siteEditsAsEntities.push({ 5204 kind: 'root', 5205 name: 'site', 5206 title: TRANSLATED_SITE_PROTPERTIES[property] || property, 5207 property 5208 }); 5209 } 5210 5211 const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities]; 5212 return { 5213 dirtyEntityRecords: dirtyRecordsWithSiteItems 5214 }; 5215 }, []); 5216 const { 5217 saveEditedEntityRecord, 5218 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 5219 } = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]); // To group entities by type. 5220 5221 const partitionedSavables = Object.values(Object(external_lodash_["groupBy"])(dirtyEntityRecords, 'name')); // Unchecked entities to be ignored by save function. 5222 5223 const [unselectedEntities, _setUnselectedEntities] = Object(external_wp_element_["useState"])([]); 5224 5225 const setUnselectedEntities = ({ 5226 kind, 5227 name, 5228 key, 5229 property 5230 }, checked) => { 5231 if (checked) { 5232 _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); 5233 } else { 5234 _setUnselectedEntities([...unselectedEntities, { 5235 kind, 5236 name, 5237 key, 5238 property 5239 }]); 5240 } 5241 }; 5242 5243 const saveCheckedEntities = () => { 5244 const entitiesToSave = dirtyEntityRecords.filter(({ 5245 kind, 5246 name, 5247 key, 5248 property 5249 }) => { 5250 return !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); 5251 }); 5252 close(entitiesToSave); 5253 const siteItemsToSave = []; 5254 entitiesToSave.forEach(({ 5255 kind, 5256 name, 5257 key, 5258 property 5259 }) => { 5260 if ('root' === kind && 'site' === name) { 5261 siteItemsToSave.push(property); 5262 } else { 5263 saveEditedEntityRecord(kind, name, key); 5264 } 5265 }); 5266 saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave); 5267 }; // Explicitly define this with no argument passed. Using `close` on 5268 // its own will use the event object in place of the expected saved entities. 5269 5270 5271 const dismissPanel = Object(external_wp_element_["useCallback"])(() => close(), [close]); 5272 const [saveDialogRef, saveDialogProps] = Object(external_wp_compose_["__experimentalUseDialog"])({ 5273 onClose: () => dismissPanel() 5274 }); 5275 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 5276 ref: saveDialogRef 5277 }, saveDialogProps, { 5278 className: "entities-saved-states__panel" 5279 }), Object(external_wp_element_["createElement"])("div", { 5280 className: "entities-saved-states__panel-header" 5281 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 5282 ref: saveButtonRef, 5283 isPrimary: true, 5284 disabled: dirtyEntityRecords.length - unselectedEntities.length === 0, 5285 onClick: saveCheckedEntities, 5286 className: "editor-entities-saved-states__save-button" 5287 }, Object(external_wp_i18n_["__"])('Save')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 5288 icon: library_close["a" /* default */], 5289 onClick: dismissPanel, 5290 label: Object(external_wp_i18n_["__"])('Close panel') 5291 })), Object(external_wp_element_["createElement"])("div", { 5292 className: "entities-saved-states__text-prompt" 5293 }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('Select the changes you want to save')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Some changes may affect other areas of your site.'))), partitionedSavables.map(list => { 5294 return Object(external_wp_element_["createElement"])(EntityTypeList, { 5295 key: list[0].name, 5296 list: list, 5297 closePanel: dismissPanel, 5298 unselectedEntities: unselectedEntities, 5299 setUnselectedEntities: setUnselectedEntities 5300 }); 5301 })); 5302 } 5303 5304 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js 5305 5306 5307 /** 5308 * WordPress dependencies 5309 */ 5310 5311 5312 5313 5314 5315 5316 5317 function CopyButton({ 5318 text, 5319 children 5320 }) { 5321 const ref = Object(external_wp_compose_["useCopyToClipboard"])(text); 5322 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 5323 isSecondary: true, 5324 ref: ref 5325 }, children); 5326 } 5327 5328 class error_boundary_ErrorBoundary extends external_wp_element_["Component"] { 5329 constructor() { 5330 super(...arguments); 5331 this.reboot = this.reboot.bind(this); 5332 this.getContent = this.getContent.bind(this); 5333 this.state = { 5334 error: null 5335 }; 5336 } 5337 5338 componentDidCatch(error) { 5339 this.setState({ 5340 error 5341 }); 5342 } 5343 5344 reboot() { 5345 this.props.onError(); 5346 } 5347 5348 getContent() { 5349 try { 5350 // While `select` in a component is generally discouraged, it is 5351 // used here because it (a) reduces the chance of data loss in the 5352 // case of additional errors by performing a direct retrieval and 5353 // (b) avoids the performance cost associated with unnecessary 5354 // content serialization throughout the lifetime of a non-erroring 5355 // application. 5356 return Object(external_wp_data_["select"])('core/editor').getEditedPostContent(); 5357 } catch (error) {} 5358 } 5359 5360 render() { 5361 const { 5362 error 5363 } = this.state; 5364 5365 if (!error) { 5366 return this.props.children; 5367 } 5368 5369 return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], { 5370 className: "editor-error-boundary", 5371 actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 5372 key: "recovery", 5373 onClick: this.reboot, 5374 isSecondary: true 5375 }, Object(external_wp_i18n_["__"])('Attempt Recovery')), Object(external_wp_element_["createElement"])(CopyButton, { 5376 key: "copy-post", 5377 text: this.getContent 5378 }, Object(external_wp_i18n_["__"])('Copy Post Text')), Object(external_wp_element_["createElement"])(CopyButton, { 5379 key: "copy-error", 5380 text: error.stack 5381 }, Object(external_wp_i18n_["__"])('Copy Error'))] 5382 }, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.')); 5383 } 5384 5385 } 5386 5387 /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary); 5388 5389 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js 5390 5391 5392 /** 5393 * External dependencies 5394 */ 5395 5396 /** 5397 * WordPress dependencies 5398 */ 5399 5400 5401 5402 5403 5404 5405 5406 /** 5407 * Internal dependencies 5408 */ 5409 5410 5411 5412 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; 5413 /** 5414 * Function which returns true if the current environment supports browser 5415 * sessionStorage, or false otherwise. The result of this function is cached and 5416 * reused in subsequent invocations. 5417 */ 5418 5419 const hasSessionStorageSupport = Object(external_lodash_["once"])(() => { 5420 try { 5421 // Private Browsing in Safari 10 and earlier will throw an error when 5422 // attempting to set into sessionStorage. The test here is intentional in 5423 // causing a thrown error as condition bailing from local autosave. 5424 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); 5425 window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); 5426 return true; 5427 } catch (error) { 5428 return false; 5429 } 5430 }); 5431 /** 5432 * Custom hook which manages the creation of a notice prompting the user to 5433 * restore a local autosave, if one exists. 5434 */ 5435 5436 function useAutosaveNotice() { 5437 const { 5438 postId, 5439 isEditedPostNew, 5440 hasRemoteAutosave 5441 } = Object(external_wp_data_["useSelect"])(select => ({ 5442 postId: select('core/editor').getCurrentPostId(), 5443 isEditedPostNew: select('core/editor').isEditedPostNew(), 5444 getEditedPostAttribute: select('core/editor').getEditedPostAttribute, 5445 hasRemoteAutosave: !!select('core/editor').getEditorSettings().autosave 5446 }), []); 5447 const { 5448 getEditedPostAttribute 5449 } = Object(external_wp_data_["useSelect"])('core/editor'); 5450 const { 5451 createWarningNotice, 5452 removeNotice 5453 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); 5454 const { 5455 editPost, 5456 resetEditorBlocks 5457 } = Object(external_wp_data_["useDispatch"])('core/editor'); 5458 Object(external_wp_element_["useEffect"])(() => { 5459 let localAutosave = localAutosaveGet(postId, isEditedPostNew); 5460 5461 if (!localAutosave) { 5462 return; 5463 } 5464 5465 try { 5466 localAutosave = JSON.parse(localAutosave); 5467 } catch (error) { 5468 // Not usable if it can't be parsed. 5469 return; 5470 } 5471 5472 const { 5473 post_title: title, 5474 content, 5475 excerpt 5476 } = localAutosave; 5477 const edits = { 5478 title, 5479 content, 5480 excerpt 5481 }; 5482 { 5483 // Only display a notice if there is a difference between what has been 5484 // saved and that which is stored in sessionStorage. 5485 const hasDifference = Object.keys(edits).some(key => { 5486 return edits[key] !== getEditedPostAttribute(key); 5487 }); 5488 5489 if (!hasDifference) { 5490 // If there is no difference, it can be safely ejected from storage. 5491 localAutosaveClear(postId, isEditedPostNew); 5492 return; 5493 } 5494 } 5495 5496 if (hasRemoteAutosave) { 5497 return; 5498 } 5499 5500 const noticeId = Object(external_lodash_["uniqueId"])('wpEditorAutosaveRestore'); 5501 createWarningNotice(Object(external_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), { 5502 id: noticeId, 5503 actions: [{ 5504 label: Object(external_wp_i18n_["__"])('Restore the backup'), 5505 5506 onClick() { 5507 editPost(Object(external_lodash_["omit"])(edits, ['content'])); 5508 resetEditorBlocks(Object(external_wp_blocks_["parse"])(edits.content)); 5509 removeNotice(noticeId); 5510 } 5511 5512 }] 5513 }); 5514 }, [isEditedPostNew, postId]); 5515 } 5516 /** 5517 * Custom hook which ejects a local autosave after a successful save occurs. 5518 */ 5519 5520 5521 function useAutosavePurge() { 5522 const { 5523 postId, 5524 isEditedPostNew, 5525 isDirty, 5526 isAutosaving, 5527 didError 5528 } = Object(external_wp_data_["useSelect"])(select => ({ 5529 postId: select('core/editor').getCurrentPostId(), 5530 isEditedPostNew: select('core/editor').isEditedPostNew(), 5531 isDirty: select('core/editor').isEditedPostDirty(), 5532 isAutosaving: select('core/editor').isAutosavingPost(), 5533 didError: select('core/editor').didPostSaveRequestFail() 5534 }), []); 5535 const lastIsDirty = Object(external_wp_element_["useRef"])(isDirty); 5536 const lastIsAutosaving = Object(external_wp_element_["useRef"])(isAutosaving); 5537 Object(external_wp_element_["useEffect"])(() => { 5538 if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) { 5539 localAutosaveClear(postId, isEditedPostNew); 5540 } 5541 5542 lastIsDirty.current = isDirty; 5543 lastIsAutosaving.current = isAutosaving; 5544 }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. 5545 5546 const wasEditedPostNew = Object(external_wp_compose_["usePrevious"])(isEditedPostNew); 5547 const prevPostId = Object(external_wp_compose_["usePrevious"])(postId); 5548 Object(external_wp_element_["useEffect"])(() => { 5549 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { 5550 localAutosaveClear(postId, true); 5551 } 5552 }, [isEditedPostNew, postId]); 5553 } 5554 5555 function LocalAutosaveMonitor() { 5556 const { 5557 autosave 5558 } = Object(external_wp_data_["useDispatch"])('core/editor'); 5559 const deferedAutosave = Object(external_wp_element_["useCallback"])(() => { 5560 requestIdleCallback(() => autosave({ 5561 local: true 5562 })); 5563 }, []); 5564 useAutosaveNotice(); 5565 useAutosavePurge(); 5566 const { 5567 localAutosaveInterval 5568 } = Object(external_wp_data_["useSelect"])(select => ({ 5569 localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval 5570 }), []); 5571 return Object(external_wp_element_["createElement"])(autosave_monitor, { 5572 interval: localAutosaveInterval, 5573 autosave: deferedAutosave 5574 }); 5575 } 5576 5577 /* harmony default export */ var local_autosave_monitor = (Object(external_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor)); 5578 5579 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js 5580 /** 5581 * External dependencies 5582 */ 5583 5584 /** 5585 * WordPress dependencies 5586 */ 5587 5588 5589 5590 /** 5591 * Internal dependencies 5592 */ 5593 5594 5595 function PageAttributesCheck({ 5596 children 5597 }) { 5598 const postType = Object(external_wp_data_["useSelect"])(select => { 5599 const { 5600 getEditedPostAttribute 5601 } = select(store); 5602 const { 5603 getPostType 5604 } = select(external_wp_coreData_["store"]); 5605 return getPostType(getEditedPostAttribute('type')); 5606 }, []); 5607 const supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. 5608 5609 if (!supportsPageAttributes) { 5610 return null; 5611 } 5612 5613 return children; 5614 } 5615 /* harmony default export */ var page_attributes_check = (PageAttributesCheck); 5616 5617 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js 5618 /** 5619 * External dependencies 5620 */ 5621 5622 /** 5623 * WordPress dependencies 5624 */ 5625 5626 5627 /** 5628 * A component which renders its own children only if the current editor post 5629 * type supports one of the given `supportKeys` prop. 5630 * 5631 * @param {Object} props Props. 5632 * @param {string} [props.postType] Current post type. 5633 * @param {WPElement} props.children Children to be rendered if post 5634 * type supports. 5635 * @param {(string|string[])} props.supportKeys String or string array of keys 5636 * to test. 5637 * 5638 * @return {WPComponent} The component to be rendered. 5639 */ 5640 5641 function PostTypeSupportCheck({ 5642 postType, 5643 children, 5644 supportKeys 5645 }) { 5646 let isSupported = true; 5647 5648 if (postType) { 5649 isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => !!postType.supports[key]); 5650 } 5651 5652 if (!isSupported) { 5653 return null; 5654 } 5655 5656 return children; 5657 } 5658 /* harmony default export */ var post_type_support_check = (Object(external_wp_data_["withSelect"])(select => { 5659 const { 5660 getEditedPostAttribute 5661 } = select('core/editor'); 5662 const { 5663 getPostType 5664 } = select('core'); 5665 return { 5666 postType: getPostType(getEditedPostAttribute('type')) 5667 }; 5668 })(PostTypeSupportCheck)); 5669 5670 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js 5671 5672 5673 /** 5674 * External dependencies 5675 */ 5676 5677 /** 5678 * WordPress dependencies 5679 */ 5680 5681 5682 5683 5684 5685 /** 5686 * Internal dependencies 5687 */ 5688 5689 5690 const PageAttributesOrder = Object(external_wp_compose_["withState"])({ 5691 orderInput: null 5692 })(({ 5693 onUpdateOrder, 5694 order = 0, 5695 orderInput, 5696 setState 5697 }) => { 5698 const setUpdatedOrder = value => { 5699 setState({ 5700 orderInput: value 5701 }); 5702 const newOrder = Number(value); 5703 5704 if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') { 5705 onUpdateOrder(Number(value)); 5706 } 5707 }; 5708 5709 const value = orderInput === null ? order : orderInput; 5710 return Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 5711 className: "editor-page-attributes__order", 5712 type: "number", 5713 label: Object(external_wp_i18n_["__"])('Order'), 5714 value: value, 5715 onChange: setUpdatedOrder, 5716 size: 6, 5717 onBlur: () => { 5718 setState({ 5719 orderInput: null 5720 }); 5721 } 5722 }); 5723 }); 5724 5725 function PageAttributesOrderWithChecks(props) { 5726 return Object(external_wp_element_["createElement"])(post_type_support_check, { 5727 supportKeys: "page-attributes" 5728 }, Object(external_wp_element_["createElement"])(PageAttributesOrder, props)); 5729 } 5730 5731 /* harmony default export */ var page_attributes_order = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 5732 return { 5733 order: select('core/editor').getEditedPostAttribute('menu_order') 5734 }; 5735 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 5736 onUpdateOrder(order) { 5737 dispatch('core/editor').editPost({ 5738 menu_order: order 5739 }); 5740 } 5741 5742 }))])(PageAttributesOrderWithChecks)); 5743 5744 // EXTERNAL MODULE: external ["wp","htmlEntities"] 5745 var external_wp_htmlEntities_ = __webpack_require__("rmEH"); 5746 5747 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js 5748 /** 5749 * External dependencies 5750 */ 5751 5752 /** 5753 * Returns terms in a tree form. 5754 * 5755 * @param {Array} flatTerms Array of terms in flat format. 5756 * 5757 * @return {Array} Array of terms in tree format. 5758 */ 5759 5760 function buildTermsTree(flatTerms) { 5761 const flatTermsWithParentAndChildren = flatTerms.map(term => { 5762 return { 5763 children: [], 5764 parent: null, 5765 ...term 5766 }; 5767 }); 5768 const termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent'); 5769 5770 if (termsByParent.null && termsByParent.null.length) { 5771 return flatTermsWithParentAndChildren; 5772 } 5773 5774 const fillWithChildren = terms => { 5775 return terms.map(term => { 5776 const children = termsByParent[term.id]; 5777 return { ...term, 5778 children: children && children.length ? fillWithChildren(children) : [] 5779 }; 5780 }); 5781 }; 5782 5783 return fillWithChildren(termsByParent['0'] || []); 5784 } // Lodash unescape function handles ' but not ' which may be return in some API requests. 5785 5786 const unescapeString = arg => { 5787 return Object(external_lodash_["unescape"])(arg.replace(''', "'")); 5788 }; 5789 /** 5790 * Returns a term object with name unescaped. 5791 * The unescape of the name property is done using lodash unescape function. 5792 * 5793 * @param {Object} term The term object to unescape. 5794 * 5795 * @return {Object} Term object with name property unescaped. 5796 */ 5797 5798 const unescapeTerm = term => { 5799 return { ...term, 5800 name: unescapeString(term.name) 5801 }; 5802 }; 5803 /** 5804 * Returns an array of term objects with names unescaped. 5805 * The unescape of each term is performed using the unescapeTerm function. 5806 * 5807 * @param {Object[]} terms Array of term objects to unescape. 5808 * 5809 * @return {Object[]} Array of term objects unescaped. 5810 */ 5811 5812 const unescapeTerms = terms => { 5813 return Object(external_lodash_["map"])(terms, unescapeTerm); 5814 }; 5815 5816 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js 5817 5818 5819 /** 5820 * External dependencies 5821 */ 5822 5823 /** 5824 * WordPress dependencies 5825 */ 5826 5827 5828 5829 5830 5831 5832 /** 5833 * Internal dependencies 5834 */ 5835 5836 5837 5838 function getTitle(post) { 5839 var _post$title; 5840 5841 return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? Object(external_wp_htmlEntities_["decodeEntities"])(post.title.rendered) : `#${post.id} (${Object(external_wp_i18n_["__"])('no title')})`; 5842 } 5843 5844 const getItemPriority = (name, searchValue) => { 5845 const normalizedName = Object(external_lodash_["deburr"])(name).toLowerCase(); 5846 const normalizedSearch = Object(external_lodash_["deburr"])(searchValue).toLowerCase(); 5847 5848 if (normalizedName === normalizedSearch) { 5849 return 0; 5850 } 5851 5852 if (normalizedName.startsWith(normalizedSearch)) { 5853 return normalizedName.length; 5854 } 5855 5856 return Infinity; 5857 }; 5858 function PageAttributesParent() { 5859 const { 5860 editPost 5861 } = Object(external_wp_data_["useDispatch"])('core/editor'); 5862 const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])(false); 5863 const { 5864 parentPost, 5865 parentPostId, 5866 items, 5867 postType 5868 } = Object(external_wp_data_["useSelect"])(select => { 5869 const { 5870 getPostType, 5871 getEntityRecords, 5872 getEntityRecord 5873 } = select('core'); 5874 const { 5875 getCurrentPostId, 5876 getEditedPostAttribute 5877 } = select('core/editor'); 5878 const postTypeSlug = getEditedPostAttribute('type'); 5879 const pageId = getEditedPostAttribute('parent'); 5880 const pType = getPostType(postTypeSlug); 5881 const postId = getCurrentPostId(); 5882 const isHierarchical = Object(external_lodash_["get"])(pType, ['hierarchical'], false); 5883 const query = { 5884 per_page: 100, 5885 exclude: postId, 5886 parent_exclude: postId, 5887 orderby: 'menu_order', 5888 order: 'asc', 5889 _fields: 'id,title,parent' 5890 }; // Perform a search when the field is changed. 5891 5892 if (!!fieldValue) { 5893 query.search = fieldValue; 5894 } 5895 5896 return { 5897 parentPostId: pageId, 5898 parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null, 5899 items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [], 5900 postType: pType 5901 }; 5902 }, [fieldValue]); 5903 const isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); 5904 const parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']); 5905 const pageItems = items || []; 5906 const parentOptions = Object(external_wp_element_["useMemo"])(() => { 5907 const getOptionsFromTree = (tree, level = 0) => { 5908 const mappedNodes = tree.map(treeNode => [{ 5909 value: treeNode.id, 5910 label: Object(external_lodash_["repeat"])('— ', level) + Object(external_lodash_["unescape"])(treeNode.name), 5911 rawName: treeNode.name 5912 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); 5913 const sortedNodes = mappedNodes.sort(([a], [b]) => { 5914 const priorityA = getItemPriority(a.rawName, fieldValue); 5915 const priorityB = getItemPriority(b.rawName, fieldValue); 5916 return priorityA >= priorityB ? 1 : -1; 5917 }); 5918 return Object(external_lodash_["flatten"])(sortedNodes); 5919 }; 5920 5921 let tree = pageItems.map(item => ({ 5922 id: item.id, 5923 parent: item.parent, 5924 name: getTitle(item) 5925 })); // Only build a hierarchical tree when not searching. 5926 5927 if (!fieldValue) { 5928 tree = buildTermsTree(tree); 5929 } 5930 5931 const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list. 5932 5933 const optsHasParent = Object(external_lodash_["find"])(opts, item => item.value === parentPostId); 5934 5935 if (parentPost && !optsHasParent) { 5936 opts.unshift({ 5937 value: parentPostId, 5938 label: getTitle(parentPost) 5939 }); 5940 } 5941 5942 return opts; 5943 }, [pageItems, fieldValue]); 5944 5945 if (!isHierarchical || !parentPageLabel) { 5946 return null; 5947 } 5948 /** 5949 * Handle user input. 5950 * 5951 * @param {string} inputValue The current value of the input field. 5952 */ 5953 5954 5955 const handleKeydown = inputValue => { 5956 setFieldValue(inputValue); 5957 }; 5958 /** 5959 * Handle author selection. 5960 * 5961 * @param {Object} selectedPostId The selected Author. 5962 */ 5963 5964 5965 const handleChange = selectedPostId => { 5966 editPost({ 5967 parent: selectedPostId 5968 }); 5969 }; 5970 5971 return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], { 5972 className: "editor-page-attributes__parent", 5973 label: parentPageLabel, 5974 value: parentPostId, 5975 options: parentOptions, 5976 onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300), 5977 onChange: handleChange 5978 }); 5979 } 5980 /* harmony default export */ var page_attributes_parent = (PageAttributesParent); 5981 5982 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js 5983 5984 5985 /** 5986 * External dependencies 5987 */ 5988 5989 /** 5990 * WordPress dependencies 5991 */ 5992 5993 5994 5995 5996 5997 /** 5998 * Internal dependencies 5999 */ 6000 6001 6002 function PostTemplate({}) { 6003 const { 6004 availableTemplates, 6005 selectedTemplate, 6006 isViewable 6007 } = Object(external_wp_data_["useSelect"])(select => { 6008 var _getPostType$viewable, _getPostType; 6009 6010 const { 6011 getEditedPostAttribute, 6012 getEditorSettings, 6013 getCurrentPostType 6014 } = select(store); 6015 const { 6016 getPostType 6017 } = select(external_wp_coreData_["store"]); 6018 return { 6019 selectedTemplate: getEditedPostAttribute('template'), 6020 availableTemplates: getEditorSettings().availableTemplates, 6021 isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false 6022 }; 6023 }, []); 6024 const { 6025 editPost 6026 } = Object(external_wp_data_["useDispatch"])(store); 6027 6028 if (!isViewable || Object(external_lodash_["isEmpty"])(availableTemplates)) { 6029 return null; 6030 } 6031 6032 return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { 6033 label: Object(external_wp_i18n_["__"])('Template:'), 6034 value: selectedTemplate, 6035 onChange: templateSlug => { 6036 editPost({ 6037 template: templateSlug || '' 6038 }); 6039 }, 6040 options: Object(external_lodash_["map"])(availableTemplates, (templateName, templateSlug) => ({ 6041 value: templateSlug, 6042 label: templateName 6043 })) 6044 }); 6045 } 6046 /* harmony default export */ var post_template = (PostTemplate); 6047 6048 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js 6049 6050 6051 /** 6052 * External dependencies 6053 */ 6054 6055 /** 6056 * WordPress dependencies 6057 */ 6058 6059 6060 6061 6062 6063 6064 function PostAuthorCombobox() { 6065 const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])(); 6066 const { 6067 authorId, 6068 isLoading, 6069 authors, 6070 postAuthor 6071 } = Object(external_wp_data_["useSelect"])(select => { 6072 const { 6073 __unstableGetAuthor, 6074 getAuthors, 6075 isResolving 6076 } = select('core'); 6077 const { 6078 getEditedPostAttribute 6079 } = select('core/editor'); 6080 6081 const author = __unstableGetAuthor(getEditedPostAttribute('author')); 6082 6083 const query = !fieldValue || '' === fieldValue ? {} : { 6084 search: fieldValue 6085 }; 6086 return { 6087 authorId: getEditedPostAttribute('author'), 6088 postAuthor: author, 6089 authors: getAuthors(query), 6090 isLoading: isResolving('core', 'getAuthors', [query]) 6091 }; 6092 }, [fieldValue]); 6093 const { 6094 editPost 6095 } = Object(external_wp_data_["useDispatch"])('core/editor'); 6096 const authorOptions = Object(external_wp_element_["useMemo"])(() => { 6097 const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { 6098 return { 6099 value: author.id, 6100 label: author.name 6101 }; 6102 }); // Ensure the current author is included in the dropdown list. 6103 6104 const foundAuthor = fetchedAuthors.findIndex(({ 6105 value 6106 }) => (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value); 6107 6108 if (foundAuthor < 0 && postAuthor) { 6109 return [{ 6110 value: postAuthor.id, 6111 label: postAuthor.name 6112 }, ...fetchedAuthors]; 6113 } 6114 6115 return fetchedAuthors; 6116 }, [authors, postAuthor]); // Initializes the post author properly 6117 // Also ensures external changes are reflected. 6118 6119 Object(external_wp_element_["useEffect"])(() => { 6120 if (postAuthor) { 6121 setFieldValue(postAuthor.name); 6122 } 6123 }, [postAuthor]); 6124 /** 6125 * Handle author selection. 6126 * 6127 * @param {number} postAuthorId The selected Author. 6128 */ 6129 6130 const handleSelect = postAuthorId => { 6131 if (!postAuthorId) { 6132 return; 6133 } 6134 6135 editPost({ 6136 author: postAuthorId 6137 }); 6138 }; 6139 /** 6140 * Handle user input. 6141 * 6142 * @param {string} inputValue The current value of the input field. 6143 */ 6144 6145 6146 const handleKeydown = inputValue => { 6147 setFieldValue(inputValue); 6148 }; 6149 6150 if (!postAuthor) { 6151 return null; 6152 } 6153 6154 return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], { 6155 label: Object(external_wp_i18n_["__"])('Author'), 6156 options: authorOptions, 6157 value: authorId, 6158 onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300), 6159 onChange: handleSelect, 6160 isLoading: isLoading, 6161 allowReset: false 6162 }); 6163 } 6164 6165 /* harmony default export */ var combobox = (PostAuthorCombobox); 6166 6167 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js 6168 6169 6170 /** 6171 * WordPress dependencies 6172 */ 6173 6174 6175 6176 6177 6178 function PostAuthorSelect() { 6179 const { 6180 editPost 6181 } = Object(external_wp_data_["useDispatch"])('core/editor'); 6182 const { 6183 postAuthor, 6184 authors 6185 } = Object(external_wp_data_["useSelect"])(select => { 6186 const authorsFromAPI = select('core').getAuthors(); 6187 return { 6188 postAuthor: select('core/editor').getEditedPostAttribute('author'), 6189 authors: authorsFromAPI.map(author => ({ 6190 label: Object(external_wp_htmlEntities_["decodeEntities"])(author.name), 6191 value: author.id 6192 })) 6193 }; 6194 }, []); 6195 6196 const setAuthorId = value => { 6197 const author = Number(value); 6198 editPost({ 6199 author 6200 }); 6201 }; 6202 6203 return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { 6204 className: "post-author-selector", 6205 label: Object(external_wp_i18n_["__"])('Author'), 6206 options: authors, 6207 onChange: setAuthorId, 6208 value: postAuthor 6209 }); 6210 } 6211 6212 /* harmony default export */ var post_author_select = (PostAuthorSelect); 6213 6214 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js 6215 6216 6217 /** 6218 * WordPress dependencies 6219 */ 6220 6221 6222 /** 6223 * Internal dependencies 6224 */ 6225 6226 6227 6228 const minimumUsersForCombobox = 25; 6229 6230 function PostAuthor() { 6231 const showCombobox = Object(external_wp_data_["useSelect"])(select => { 6232 // Not using `getUsers()` because it requires `list_users` capability. 6233 const authors = select(external_wp_coreData_["store"]).getAuthors(); 6234 return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox; 6235 }, []); 6236 6237 if (showCombobox) { 6238 return Object(external_wp_element_["createElement"])(combobox, null); 6239 } 6240 6241 return Object(external_wp_element_["createElement"])(post_author_select, null); 6242 } 6243 6244 /* harmony default export */ var post_author = (PostAuthor); 6245 6246 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js 6247 6248 6249 /** 6250 * External dependencies 6251 */ 6252 6253 /** 6254 * WordPress dependencies 6255 */ 6256 6257 6258 6259 /** 6260 * Internal dependencies 6261 */ 6262 6263 6264 function PostAuthorCheck({ 6265 hasAssignAuthorAction, 6266 authors, 6267 children 6268 }) { 6269 if (!hasAssignAuthorAction || !authors || 1 >= authors.length) { 6270 return null; 6271 } 6272 6273 return Object(external_wp_element_["createElement"])(post_type_support_check, { 6274 supportKeys: "author" 6275 }, children); 6276 } 6277 /* harmony default export */ var post_author_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 6278 const post = select('core/editor').getCurrentPost(); 6279 return { 6280 hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false), 6281 postType: select('core/editor').getCurrentPostType(), 6282 authors: select('core').getAuthors() 6283 }; 6284 }), external_wp_compose_["withInstanceId"]])(PostAuthorCheck)); 6285 6286 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js 6287 6288 6289 /** 6290 * WordPress dependencies 6291 */ 6292 6293 6294 6295 6296 6297 function PostComments({ 6298 commentStatus = 'open', 6299 ...props 6300 }) { 6301 const onToggleComments = () => props.editPost({ 6302 comment_status: commentStatus === 'open' ? 'closed' : 'open' 6303 }); 6304 6305 return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 6306 label: Object(external_wp_i18n_["__"])('Allow comments'), 6307 checked: commentStatus === 'open', 6308 onChange: onToggleComments 6309 }); 6310 } 6311 6312 /* harmony default export */ var post_comments = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 6313 return { 6314 commentStatus: select('core/editor').getEditedPostAttribute('comment_status') 6315 }; 6316 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 6317 editPost: dispatch('core/editor').editPost 6318 }))])(PostComments)); 6319 6320 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js 6321 6322 6323 /** 6324 * WordPress dependencies 6325 */ 6326 6327 6328 6329 6330 6331 function PostExcerpt({ 6332 excerpt, 6333 onUpdateExcerpt 6334 }) { 6335 return Object(external_wp_element_["createElement"])("div", { 6336 className: "editor-post-excerpt" 6337 }, Object(external_wp_element_["createElement"])(external_wp_components_["TextareaControl"], { 6338 label: Object(external_wp_i18n_["__"])('Write an excerpt (optional)'), 6339 className: "editor-post-excerpt__textarea", 6340 onChange: value => onUpdateExcerpt(value), 6341 value: excerpt 6342 }), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { 6343 href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/excerpt/') 6344 }, Object(external_wp_i18n_["__"])('Learn more about manual excerpts'))); 6345 } 6346 6347 /* harmony default export */ var post_excerpt = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 6348 return { 6349 excerpt: select('core/editor').getEditedPostAttribute('excerpt') 6350 }; 6351 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 6352 onUpdateExcerpt(excerpt) { 6353 dispatch('core/editor').editPost({ 6354 excerpt 6355 }); 6356 } 6357 6358 }))])(PostExcerpt)); 6359 6360 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js 6361 6362 6363 6364 /** 6365 * Internal dependencies 6366 */ 6367 6368 6369 function PostExcerptCheck(props) { 6370 return Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { 6371 supportKeys: "excerpt" 6372 })); 6373 } 6374 6375 /* harmony default export */ var post_excerpt_check = (PostExcerptCheck); 6376 6377 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js 6378 /** 6379 * External dependencies 6380 */ 6381 6382 /** 6383 * WordPress dependencies 6384 */ 6385 6386 6387 function ThemeSupportCheck({ 6388 themeSupports, 6389 children, 6390 postType, 6391 supportKeys 6392 }) { 6393 const isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => { 6394 const supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. 6395 // In the latter case, we need to verify `postType` exists 6396 // within `supported`. If `postType` isn't passed, then the check 6397 // should fail. 6398 6399 if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) { 6400 return Object(external_lodash_["includes"])(supported, postType); 6401 } 6402 6403 return supported; 6404 }); 6405 6406 if (!isSupported) { 6407 return null; 6408 } 6409 6410 return children; 6411 } 6412 /* harmony default export */ var theme_support_check = (Object(external_wp_data_["withSelect"])(select => { 6413 const { 6414 getThemeSupports 6415 } = select('core'); 6416 const { 6417 getEditedPostAttribute 6418 } = select('core/editor'); 6419 return { 6420 postType: getEditedPostAttribute('type'), 6421 themeSupports: getThemeSupports() 6422 }; 6423 })(ThemeSupportCheck)); 6424 6425 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js 6426 6427 6428 6429 /** 6430 * Internal dependencies 6431 */ 6432 6433 6434 6435 function PostFeaturedImageCheck(props) { 6436 return Object(external_wp_element_["createElement"])(theme_support_check, { 6437 supportKeys: "post-thumbnails" 6438 }, Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { 6439 supportKeys: "thumbnail" 6440 }))); 6441 } 6442 6443 /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); 6444 6445 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js 6446 6447 6448 /** 6449 * External dependencies 6450 */ 6451 6452 /** 6453 * WordPress dependencies 6454 */ 6455 6456 6457 6458 6459 6460 6461 6462 /** 6463 * Internal dependencies 6464 */ 6465 6466 6467 const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. 6468 6469 const DEFAULT_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Featured image'); 6470 6471 const DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Set featured image'); 6472 6473 const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Remove image'); 6474 6475 function PostFeaturedImage({ 6476 currentPostId, 6477 featuredImageId, 6478 onUpdateImage, 6479 onDropImage, 6480 onRemoveImage, 6481 media, 6482 postType, 6483 noticeUI 6484 }) { 6485 var _media$media_details$, _media$media_details$2; 6486 6487 const postLabel = Object(external_lodash_["get"])(postType, ['labels'], {}); 6488 const instructions = Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.')); 6489 let mediaWidth, mediaHeight, mediaSourceUrl; 6490 6491 if (media) { 6492 const mediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); 6493 6494 if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) { 6495 // use mediaSize when available 6496 mediaWidth = media.media_details.sizes[mediaSize].width; 6497 mediaHeight = media.media_details.sizes[mediaSize].height; 6498 mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; 6499 } else { 6500 // get fallbackMediaSize if mediaSize is not available 6501 const fallbackMediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId); 6502 6503 if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', fallbackMediaSize])) { 6504 // use fallbackMediaSize when mediaSize is not available 6505 mediaWidth = media.media_details.sizes[fallbackMediaSize].width; 6506 mediaHeight = media.media_details.sizes[fallbackMediaSize].height; 6507 mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url; 6508 } else { 6509 // use full image size when mediaFallbackSize and mediaSize are not available 6510 mediaWidth = media.media_details.width; 6511 mediaHeight = media.media_details.height; 6512 mediaSourceUrl = media.source_url; 6513 } 6514 } 6515 } 6516 6517 return Object(external_wp_element_["createElement"])(post_featured_image_check, null, noticeUI, Object(external_wp_element_["createElement"])("div", { 6518 className: "editor-post-featured-image" 6519 }, media && Object(external_wp_element_["createElement"])("div", { 6520 id: `editor-post-featured-image-${featuredImageId}-describedby`, 6521 className: "hidden" 6522 }, media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image alt text. 6523 Object(external_wp_i18n_["__"])('Current image: %s'), media.alt_text), !media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image filename. 6524 Object(external_wp_i18n_["__"])('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], { 6525 fallback: instructions 6526 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], { 6527 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 6528 onSelect: onUpdateImage, 6529 unstableFeaturedImageFlow: true, 6530 allowedTypes: ALLOWED_MEDIA_TYPES, 6531 modalClass: "editor-post-featured-image__media-modal", 6532 render: ({ 6533 open 6534 }) => Object(external_wp_element_["createElement"])("div", { 6535 className: "editor-post-featured-image__container" 6536 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 6537 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', 6538 onClick: open, 6539 "aria-label": !featuredImageId ? null : Object(external_wp_i18n_["__"])('Edit or update the image'), 6540 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby` 6541 }, !!featuredImageId && media && Object(external_wp_element_["createElement"])(external_wp_components_["ResponsiveWrapper"], { 6542 naturalWidth: mediaWidth, 6543 naturalHeight: mediaHeight, 6544 isInline: true 6545 }, Object(external_wp_element_["createElement"])("img", { 6546 src: mediaSourceUrl, 6547 alt: "" 6548 })), !!featuredImageId && !media && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), Object(external_wp_element_["createElement"])(external_wp_components_["DropZone"], { 6549 onFilesDrop: onDropImage 6550 })), 6551 value: featuredImageId 6552 })), !!featuredImageId && media && !media.isLoading && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], { 6553 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 6554 onSelect: onUpdateImage, 6555 unstableFeaturedImageFlow: true, 6556 allowedTypes: ALLOWED_MEDIA_TYPES, 6557 modalClass: "editor-post-featured-image__media-modal", 6558 render: ({ 6559 open 6560 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 6561 onClick: open, 6562 isSecondary: true 6563 }, Object(external_wp_i18n_["__"])('Replace Image')) 6564 })), !!featuredImageId && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 6565 onClick: onRemoveImage, 6566 isLink: true, 6567 isDestructive: true 6568 }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL)))); 6569 } 6570 6571 const applyWithSelect = Object(external_wp_data_["withSelect"])(select => { 6572 const { 6573 getMedia, 6574 getPostType 6575 } = select('core'); 6576 const { 6577 getCurrentPostId, 6578 getEditedPostAttribute 6579 } = select('core/editor'); 6580 const featuredImageId = getEditedPostAttribute('featured_media'); 6581 return { 6582 media: featuredImageId ? getMedia(featuredImageId) : null, 6583 currentPostId: getCurrentPostId(), 6584 postType: getPostType(getEditedPostAttribute('type')), 6585 featuredImageId 6586 }; 6587 }); 6588 const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, { 6589 noticeOperations 6590 }, { 6591 select 6592 }) => { 6593 const { 6594 editPost 6595 } = dispatch('core/editor'); 6596 return { 6597 onUpdateImage(image) { 6598 editPost({ 6599 featured_media: image.id 6600 }); 6601 }, 6602 6603 onDropImage(filesList) { 6604 select(external_wp_blockEditor_["store"]).getSettings().mediaUpload({ 6605 allowedTypes: ['image'], 6606 filesList, 6607 6608 onFileChange([image]) { 6609 editPost({ 6610 featured_media: image.id 6611 }); 6612 }, 6613 6614 onError(message) { 6615 noticeOperations.removeAllNotices(); 6616 noticeOperations.createErrorNotice(message); 6617 } 6618 6619 }); 6620 }, 6621 6622 onRemoveImage() { 6623 editPost({ 6624 featured_media: 0 6625 }); 6626 } 6627 6628 }; 6629 }); 6630 /* harmony default export */ var post_featured_image = (Object(external_wp_compose_["compose"])(external_wp_components_["withNotices"], applyWithSelect, applyWithDispatch, Object(external_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage)); 6631 6632 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js 6633 6634 6635 6636 /** 6637 * WordPress dependencies 6638 */ 6639 6640 /** 6641 * Internal dependencies 6642 */ 6643 6644 6645 6646 function PostFormatCheck({ 6647 disablePostFormats, 6648 ...props 6649 }) { 6650 return !disablePostFormats && Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { 6651 supportKeys: "post-formats" 6652 })); 6653 } 6654 6655 /* harmony default export */ var post_format_check = (Object(external_wp_data_["withSelect"])(select => { 6656 const editorSettings = select('core/editor').getEditorSettings(); 6657 return { 6658 disablePostFormats: editorSettings.disablePostFormats 6659 }; 6660 })(PostFormatCheck)); 6661 6662 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js 6663 6664 6665 /** 6666 * External dependencies 6667 */ 6668 6669 /** 6670 * WordPress dependencies 6671 */ 6672 6673 6674 6675 6676 6677 /** 6678 * Internal dependencies 6679 */ 6680 6681 // All WP post formats, sorted alphabetically by translated name. 6682 6683 const POST_FORMATS = [{ 6684 id: 'aside', 6685 caption: Object(external_wp_i18n_["__"])('Aside') 6686 }, { 6687 id: 'audio', 6688 caption: Object(external_wp_i18n_["__"])('Audio') 6689 }, { 6690 id: 'chat', 6691 caption: Object(external_wp_i18n_["__"])('Chat') 6692 }, { 6693 id: 'gallery', 6694 caption: Object(external_wp_i18n_["__"])('Gallery') 6695 }, { 6696 id: 'image', 6697 caption: Object(external_wp_i18n_["__"])('Image') 6698 }, { 6699 id: 'link', 6700 caption: Object(external_wp_i18n_["__"])('Link') 6701 }, { 6702 id: 'quote', 6703 caption: Object(external_wp_i18n_["__"])('Quote') 6704 }, { 6705 id: 'standard', 6706 caption: Object(external_wp_i18n_["__"])('Standard') 6707 }, { 6708 id: 'status', 6709 caption: Object(external_wp_i18n_["__"])('Status') 6710 }, { 6711 id: 'video', 6712 caption: Object(external_wp_i18n_["__"])('Video') 6713 }].sort((a, b) => { 6714 const normalizedA = a.caption.toUpperCase(); 6715 const normalizedB = b.caption.toUpperCase(); 6716 6717 if (normalizedA < normalizedB) { 6718 return -1; 6719 } 6720 6721 if (normalizedA > normalizedB) { 6722 return 1; 6723 } 6724 6725 return 0; 6726 }); 6727 function PostFormat() { 6728 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostFormat); 6729 const postFormatSelectorId = `post-format-selector-${instanceId}`; 6730 const { 6731 postFormat, 6732 suggestedFormat, 6733 supportedFormats 6734 } = Object(external_wp_data_["useSelect"])(select => { 6735 const { 6736 getEditedPostAttribute, 6737 getSuggestedPostFormat 6738 } = select('core/editor'); 6739 6740 const _postFormat = getEditedPostAttribute('format'); 6741 6742 const themeSupports = select('core').getThemeSupports(); 6743 return { 6744 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', 6745 suggestedFormat: getSuggestedPostFormat(), 6746 // Ensure current format is always in the set. 6747 // The current format may not be a format supported by the theme. 6748 supportedFormats: Object(external_lodash_["union"])([_postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], [])) 6749 }; 6750 }, []); 6751 const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id)); 6752 const suggestion = Object(external_lodash_["find"])(formats, format => format.id === suggestedFormat); 6753 const { 6754 editPost 6755 } = Object(external_wp_data_["useDispatch"])('core/editor'); 6756 6757 const onUpdatePostFormat = format => editPost({ 6758 format 6759 }); 6760 6761 return Object(external_wp_element_["createElement"])(post_format_check, null, Object(external_wp_element_["createElement"])("div", { 6762 className: "editor-post-format" 6763 }, Object(external_wp_element_["createElement"])("div", { 6764 className: "editor-post-format__content" 6765 }, Object(external_wp_element_["createElement"])("label", { 6766 htmlFor: postFormatSelectorId 6767 }, Object(external_wp_i18n_["__"])('Post Format')), Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { 6768 value: postFormat, 6769 onChange: format => onUpdatePostFormat(format), 6770 id: postFormatSelectorId, 6771 options: formats.map(format => ({ 6772 label: format.caption, 6773 value: format.id 6774 })) 6775 })), suggestion && suggestion.id !== postFormat && Object(external_wp_element_["createElement"])("div", { 6776 className: "editor-post-format__suggestion" 6777 }, Object(external_wp_i18n_["__"])('Suggestion:'), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 6778 isLink: true, 6779 onClick: () => onUpdatePostFormat(suggestion.id) 6780 }, suggestion.caption)))); 6781 } 6782 6783 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js 6784 6785 6786 /** 6787 * WordPress dependencies 6788 */ 6789 6790 const backup = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 6791 xmlns: "http://www.w3.org/2000/svg", 6792 viewBox: "0 0 24 24" 6793 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 6794 d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" 6795 })); 6796 /* harmony default export */ var library_backup = (backup); 6797 6798 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js 6799 6800 6801 /** 6802 * WordPress dependencies 6803 */ 6804 6805 /** 6806 * Internal dependencies 6807 */ 6808 6809 6810 function PostLastRevisionCheck({ 6811 lastRevisionId, 6812 revisionsCount, 6813 children 6814 }) { 6815 if (!lastRevisionId || revisionsCount < 2) { 6816 return null; 6817 } 6818 6819 return Object(external_wp_element_["createElement"])(post_type_support_check, { 6820 supportKeys: "revisions" 6821 }, children); 6822 } 6823 /* harmony default export */ var post_last_revision_check = (Object(external_wp_data_["withSelect"])(select => { 6824 const { 6825 getCurrentPostLastRevisionId, 6826 getCurrentPostRevisionsCount 6827 } = select('core/editor'); 6828 return { 6829 lastRevisionId: getCurrentPostLastRevisionId(), 6830 revisionsCount: getCurrentPostRevisionsCount() 6831 }; 6832 })(PostLastRevisionCheck)); 6833 6834 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js 6835 6836 6837 /** 6838 * WordPress dependencies 6839 */ 6840 6841 6842 6843 6844 /** 6845 * Internal dependencies 6846 */ 6847 6848 6849 6850 6851 function LastRevision({ 6852 lastRevisionId, 6853 revisionsCount 6854 }) { 6855 return Object(external_wp_element_["createElement"])(post_last_revision_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 6856 href: getWPAdminURL('revision.php', { 6857 revision: lastRevisionId, 6858 gutenberg: true 6859 }), 6860 className: "editor-post-last-revision__title", 6861 icon: library_backup 6862 }, Object(external_wp_i18n_["sprintf"])( 6863 /* translators: %d: number of revisions */ 6864 Object(external_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); 6865 } 6866 6867 /* harmony default export */ var post_last_revision = (Object(external_wp_data_["withSelect"])(select => { 6868 const { 6869 getCurrentPostLastRevisionId, 6870 getCurrentPostRevisionsCount 6871 } = select('core/editor'); 6872 return { 6873 lastRevisionId: getCurrentPostLastRevisionId(), 6874 revisionsCount: getCurrentPostRevisionsCount() 6875 }; 6876 })(LastRevision)); 6877 6878 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js 6879 6880 6881 /** 6882 * External dependencies 6883 */ 6884 6885 6886 /** 6887 * WordPress dependencies 6888 */ 6889 6890 6891 6892 6893 6894 6895 6896 6897 function writeInterstitialMessage(targetDocument) { 6898 let markup = Object(external_wp_element_["renderToString"])(Object(external_wp_element_["createElement"])("div", { 6899 className: "editor-post-preview-button__interstitial-message" 6900 }, Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 6901 xmlns: "http://www.w3.org/2000/svg", 6902 viewBox: "0 0 96 96" 6903 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 6904 className: "outer", 6905 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", 6906 fill: "none" 6907 }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 6908 className: "inner", 6909 d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", 6910 fill: "none" 6911 })), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Generating preview…')))); 6912 markup += ` 6913 <style> 6914 body { 6915 margin: 0; 6916 } 6917 .editor-post-preview-button__interstitial-message { 6918 display: flex; 6919 flex-direction: column; 6920 align-items: center; 6921 justify-content: center; 6922 height: 100vh; 6923 width: 100vw; 6924 } 6925 @-webkit-keyframes paint { 6926 0% { 6927 stroke-dashoffset: 0; 6928 } 6929 } 6930 @-moz-keyframes paint { 6931 0% { 6932 stroke-dashoffset: 0; 6933 } 6934 } 6935 @-o-keyframes paint { 6936 0% { 6937 stroke-dashoffset: 0; 6938 } 6939 } 6940 @keyframes paint { 6941 0% { 6942 stroke-dashoffset: 0; 6943 } 6944 } 6945 .editor-post-preview-button__interstitial-message svg { 6946 width: 192px; 6947 height: 192px; 6948 stroke: #555d66; 6949 stroke-width: 0.75; 6950 } 6951 .editor-post-preview-button__interstitial-message svg .outer, 6952 .editor-post-preview-button__interstitial-message svg .inner { 6953 stroke-dasharray: 280; 6954 stroke-dashoffset: 280; 6955 -webkit-animation: paint 1.5s ease infinite alternate; 6956 -moz-animation: paint 1.5s ease infinite alternate; 6957 -o-animation: paint 1.5s ease infinite alternate; 6958 animation: paint 1.5s ease infinite alternate; 6959 } 6960 p { 6961 text-align: center; 6962 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 6963 } 6964 </style> 6965 `; 6966 /** 6967 * Filters the interstitial message shown when generating previews. 6968 * 6969 * @param {string} markup The preview interstitial markup. 6970 */ 6971 6972 markup = Object(external_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup); 6973 targetDocument.write(markup); 6974 targetDocument.title = Object(external_wp_i18n_["__"])('Generating preview…'); 6975 targetDocument.close(); 6976 } 6977 6978 class post_preview_button_PostPreviewButton extends external_wp_element_["Component"] { 6979 constructor() { 6980 super(...arguments); 6981 this.buttonRef = Object(external_wp_element_["createRef"])(); 6982 this.openPreviewWindow = this.openPreviewWindow.bind(this); 6983 } 6984 6985 componentDidUpdate(prevProps) { 6986 const { 6987 previewLink 6988 } = this.props; // This relies on the window being responsible to unset itself when 6989 // navigation occurs or a new preview window is opened, to avoid 6990 // unintentional forceful redirects. 6991 6992 if (previewLink && !prevProps.previewLink) { 6993 this.setPreviewWindowLink(previewLink); 6994 } 6995 } 6996 /** 6997 * Sets the preview window's location to the given URL, if a preview window 6998 * exists and is not closed. 6999 * 7000 * @param {string} url URL to assign as preview window location. 7001 */ 7002 7003 7004 setPreviewWindowLink(url) { 7005 const { 7006 previewWindow 7007 } = this; 7008 7009 if (previewWindow && !previewWindow.closed) { 7010 previewWindow.location = url; 7011 7012 if (this.buttonRef.current) { 7013 this.buttonRef.current.focus(); 7014 } 7015 } 7016 } 7017 7018 getWindowTarget() { 7019 const { 7020 postId 7021 } = this.props; 7022 return `wp-preview-${postId}`; 7023 } 7024 7025 openPreviewWindow(event) { 7026 // Our Preview button has its 'href' and 'target' set correctly for a11y 7027 // purposes. Unfortunately, though, we can't rely on the default 'click' 7028 // handler since sometimes it incorrectly opens a new tab instead of reusing 7029 // the existing one. 7030 // https://github.com/WordPress/gutenberg/pull/8330 7031 event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview. 7032 7033 if (!this.previewWindow || this.previewWindow.closed) { 7034 this.previewWindow = window.open('', this.getWindowTarget()); 7035 } // Focus the Preview tab. This might not do anything, depending on the browser's 7036 // and user's preferences. 7037 // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus 7038 7039 7040 this.previewWindow.focus(); 7041 7042 if ( // If we don't need to autosave the post before previewing, then we simply 7043 // load the Preview URL in the Preview tab. 7044 !this.props.isAutosaveable || // Do not save or overwrite the post, if the post is already locked. 7045 this.props.isPostLocked) { 7046 this.setPreviewWindowLink(event.target.href); 7047 return; 7048 } // Request an autosave. This happens asynchronously and causes the component 7049 // to update when finished. 7050 7051 7052 if (this.props.isDraft) { 7053 this.props.savePost({ 7054 isPreview: true 7055 }); 7056 } else { 7057 this.props.autosave({ 7058 isPreview: true 7059 }); 7060 } // Display a 'Generating preview' message in the Preview tab while we wait for the 7061 // autosave to finish. 7062 7063 7064 writeInterstitialMessage(this.previewWindow.document); 7065 } 7066 7067 render() { 7068 const { 7069 previewLink, 7070 currentPostLink, 7071 isSaveable, 7072 role 7073 } = this.props; // Link to the `?preview=true` URL if we have it, since this lets us see 7074 // changes that were autosaved since the post was last published. Otherwise, 7075 // just link to the post's URL. 7076 7077 const href = previewLink || currentPostLink; 7078 const classNames = classnames_default()({ 7079 'editor-post-preview': !this.props.className 7080 }, this.props.className); 7081 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 7082 isTertiary: !this.props.className, 7083 className: classNames, 7084 href: href, 7085 target: this.getWindowTarget(), 7086 disabled: !isSaveable, 7087 onClick: this.openPreviewWindow, 7088 ref: this.buttonRef, 7089 role: role 7090 }, this.props.textContent ? this.props.textContent : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 7091 as: "span" 7092 }, 7093 /* translators: accessibility text */ 7094 Object(external_wp_i18n_["__"])('(opens in a new tab)')))); 7095 } 7096 7097 } 7098 /* harmony default export */ var post_preview_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { 7099 forcePreviewLink, 7100 forceIsAutosaveable 7101 }) => { 7102 const { 7103 getCurrentPostId, 7104 getCurrentPostAttribute, 7105 getEditedPostAttribute, 7106 isEditedPostSaveable, 7107 isEditedPostAutosaveable, 7108 getEditedPostPreviewLink, 7109 isPostLocked 7110 } = select('core/editor'); 7111 const { 7112 getPostType 7113 } = select('core'); 7114 const previewLink = getEditedPostPreviewLink(); 7115 const postType = getPostType(getEditedPostAttribute('type')); 7116 return { 7117 postId: getCurrentPostId(), 7118 currentPostLink: getCurrentPostAttribute('link'), 7119 previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, 7120 isSaveable: isEditedPostSaveable(), 7121 isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), 7122 isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), 7123 isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1, 7124 isPostLocked: isPostLocked() 7125 }; 7126 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 7127 autosave: dispatch('core/editor').autosave, 7128 savePost: dispatch('core/editor').savePost 7129 })), Object(external_wp_compose_["ifCondition"])(({ 7130 isViewable 7131 }) => isViewable)])(post_preview_button_PostPreviewButton)); 7132 7133 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js 7134 7135 7136 /** 7137 * External dependencies 7138 */ 7139 7140 /** 7141 * WordPress dependencies 7142 */ 7143 7144 7145 7146 7147 7148 7149 7150 7151 /** 7152 * Internal dependencies 7153 */ 7154 7155 7156 7157 function PostLockedModal() { 7158 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostLockedModal); 7159 const hookName = 'core/editor/post-locked-modal-' + instanceId; 7160 const { 7161 autosave, 7162 updatePostLock 7163 } = Object(external_wp_data_["useDispatch"])('core/editor'); 7164 const { 7165 isLocked, 7166 isTakeover, 7167 user, 7168 postId, 7169 postLockUtils, 7170 activePostLock, 7171 postType 7172 } = Object(external_wp_data_["useSelect"])(select => { 7173 const { 7174 isPostLocked, 7175 isPostLockTakeover, 7176 getPostLockUser, 7177 getCurrentPostId, 7178 getActivePostLock, 7179 getEditedPostAttribute, 7180 getEditorSettings 7181 } = select('core/editor'); 7182 const { 7183 getPostType 7184 } = select('core'); 7185 return { 7186 isLocked: isPostLocked(), 7187 isTakeover: isPostLockTakeover(), 7188 user: getPostLockUser(), 7189 postId: getCurrentPostId(), 7190 postLockUtils: getEditorSettings().postLockUtils, 7191 activePostLock: getActivePostLock(), 7192 postType: getPostType(getEditedPostAttribute('type')) 7193 }; 7194 }); 7195 Object(external_wp_element_["useEffect"])(() => { 7196 /** 7197 * Keep the lock refreshed. 7198 * 7199 * When the user does not send a heartbeat in a heartbeat-tick 7200 * the user is no longer editing and another user can start editing. 7201 * 7202 * @param {Object} data Data to send in the heartbeat request. 7203 */ 7204 function sendPostLock(data) { 7205 if (isLocked) { 7206 return; 7207 } 7208 7209 data['wp-refresh-post-lock'] = { 7210 lock: activePostLock, 7211 post_id: postId 7212 }; 7213 } 7214 /** 7215 * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. 7216 * 7217 * @param {Object} data Data received in the heartbeat request 7218 */ 7219 7220 7221 function receivePostLock(data) { 7222 if (!data['wp-refresh-post-lock']) { 7223 return; 7224 } 7225 7226 const received = data['wp-refresh-post-lock']; 7227 7228 if (received.lock_error) { 7229 // Auto save and display the takeover modal. 7230 autosave(); 7231 updatePostLock({ 7232 isLocked: true, 7233 isTakeover: true, 7234 user: { 7235 avatar: received.lock_error.avatar_src 7236 } 7237 }); 7238 } else if (received.new_lock) { 7239 updatePostLock({ 7240 isLocked: false, 7241 activePostLock: received.new_lock 7242 }); 7243 } 7244 } 7245 /** 7246 * Unlock the post before the window is exited. 7247 */ 7248 7249 7250 function releasePostLock() { 7251 if (isLocked || !activePostLock) { 7252 return; 7253 } 7254 7255 const data = new window.FormData(); 7256 data.append('action', 'wp-remove-post-lock'); 7257 data.append('_wpnonce', postLockUtils.unlockNonce); 7258 data.append('post_ID', postId); 7259 data.append('active_post_lock', activePostLock); 7260 7261 if (window.navigator.sendBeacon) { 7262 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); 7263 } else { 7264 const xhr = new window.XMLHttpRequest(); 7265 xhr.open('POST', postLockUtils.ajaxUrl, false); 7266 xhr.send(data); 7267 } 7268 } // Details on these events on the Heartbeat API docs 7269 // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ 7270 7271 7272 Object(external_wp_hooks_["addAction"])('heartbeat.send', hookName, sendPostLock); 7273 Object(external_wp_hooks_["addAction"])('heartbeat.tick', hookName, receivePostLock); 7274 window.addEventListener('beforeunload', releasePostLock); 7275 return () => { 7276 Object(external_wp_hooks_["removeAction"])('heartbeat.send', hookName); 7277 Object(external_wp_hooks_["removeAction"])('heartbeat.tick', hookName); 7278 window.removeEventListener('beforeunload', releasePostLock); 7279 }; 7280 }, []); 7281 7282 if (!isLocked) { 7283 return null; 7284 } 7285 7286 const userDisplayName = user.name; 7287 const userAvatar = user.avatar; 7288 const unlockUrl = Object(external_wp_url_["addQueryArgs"])('post.php', { 7289 'get-post-lock': '1', 7290 lockKey: true, 7291 post: postId, 7292 action: 'edit', 7293 _wpnonce: postLockUtils.nonce 7294 }); 7295 const allPostsUrl = getWPAdminURL('edit.php', { 7296 post_type: Object(external_lodash_["get"])(postType, ['slug']) 7297 }); 7298 7299 const allPostsLabel = Object(external_wp_i18n_["__"])('Exit the Editor'); 7300 7301 return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], { 7302 title: isTakeover ? Object(external_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_wp_i18n_["__"])('This post is already being edited.'), 7303 focusOnMount: true, 7304 shouldCloseOnClickOutside: false, 7305 shouldCloseOnEsc: false, 7306 isDismissible: false, 7307 className: "editor-post-locked-modal" 7308 }, !!userAvatar && Object(external_wp_element_["createElement"])("img", { 7309 src: userAvatar, 7310 alt: Object(external_wp_i18n_["__"])('Avatar'), 7311 className: "editor-post-locked-modal__avatar" 7312 }), !!isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])( 7313 /* translators: %s: user's display name */ 7314 Object(external_wp_i18n_["__"])('%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.')), Object(external_wp_element_["createElement"])("div", { 7315 className: "editor-post-locked-modal__buttons" 7316 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 7317 isPrimary: true, 7318 href: allPostsUrl 7319 }, allPostsLabel))), !isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])( 7320 /* translators: %s: user's display name */ 7321 Object(external_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_wp_element_["createElement"])("div", { 7322 className: "editor-post-locked-modal__buttons" 7323 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 7324 isSecondary: true, 7325 href: allPostsUrl 7326 }, allPostsLabel), Object(external_wp_element_["createElement"])(post_preview_button, null), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 7327 isPrimary: true, 7328 href: unlockUrl 7329 }, Object(external_wp_i18n_["__"])('Take Over'))))); 7330 } 7331 7332 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js 7333 /** 7334 * External dependencies 7335 */ 7336 7337 /** 7338 * WordPress dependencies 7339 */ 7340 7341 7342 7343 function PostPendingStatusCheck({ 7344 hasPublishAction, 7345 isPublished, 7346 children 7347 }) { 7348 if (isPublished || !hasPublishAction) { 7349 return null; 7350 } 7351 7352 return children; 7353 } 7354 /* harmony default export */ var post_pending_status_check = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => { 7355 const { 7356 isCurrentPostPublished, 7357 getCurrentPostType, 7358 getCurrentPost 7359 } = select('core/editor'); 7360 return { 7361 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 7362 isPublished: isCurrentPostPublished(), 7363 postType: getCurrentPostType() 7364 }; 7365 }))(PostPendingStatusCheck)); 7366 7367 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js 7368 7369 7370 /** 7371 * WordPress dependencies 7372 */ 7373 7374 7375 7376 7377 /** 7378 * Internal dependencies 7379 */ 7380 7381 7382 function PostPendingStatus({ 7383 status, 7384 onUpdateStatus 7385 }) { 7386 const togglePendingStatus = () => { 7387 const updatedStatus = status === 'pending' ? 'draft' : 'pending'; 7388 onUpdateStatus(updatedStatus); 7389 }; 7390 7391 return Object(external_wp_element_["createElement"])(post_pending_status_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 7392 label: Object(external_wp_i18n_["__"])('Pending review'), 7393 checked: status === 'pending', 7394 onChange: togglePendingStatus 7395 })); 7396 } 7397 /* harmony default export */ var post_pending_status = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({ 7398 status: select('core/editor').getEditedPostAttribute('status') 7399 })), Object(external_wp_data_["withDispatch"])(dispatch => ({ 7400 onUpdateStatus(status) { 7401 dispatch('core/editor').editPost({ 7402 status 7403 }); 7404 } 7405 7406 })))(PostPendingStatus)); 7407 7408 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js 7409 7410 7411 /** 7412 * WordPress dependencies 7413 */ 7414 7415 7416 7417 7418 7419 function PostPingbacks({ 7420 pingStatus = 'open', 7421 ...props 7422 }) { 7423 const onTogglePingback = () => props.editPost({ 7424 ping_status: pingStatus === 'open' ? 'closed' : 'open' 7425 }); 7426 7427 return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 7428 label: Object(external_wp_i18n_["__"])('Allow pingbacks & trackbacks'), 7429 checked: pingStatus === 'open', 7430 onChange: onTogglePingback 7431 }); 7432 } 7433 7434 /* harmony default export */ var post_pingbacks = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 7435 return { 7436 pingStatus: select('core/editor').getEditedPostAttribute('ping_status') 7437 }; 7438 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 7439 editPost: dispatch('core/editor').editPost 7440 }))])(PostPingbacks)); 7441 7442 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js 7443 /** 7444 * External dependencies 7445 */ 7446 7447 /** 7448 * WordPress dependencies 7449 */ 7450 7451 7452 7453 7454 function PublishButtonLabel({ 7455 isPublished, 7456 isBeingScheduled, 7457 isSaving, 7458 isPublishing, 7459 hasPublishAction, 7460 isAutosaving, 7461 hasNonPostEntityChanges 7462 }) { 7463 if (isPublishing) { 7464 /* translators: button label text should, if possible, be under 16 characters. */ 7465 return Object(external_wp_i18n_["__"])('Publishing…'); 7466 } else if (isPublished && isSaving && !isAutosaving) { 7467 /* translators: button label text should, if possible, be under 16 characters. */ 7468 return Object(external_wp_i18n_["__"])('Updating…'); 7469 } else if (isBeingScheduled && isSaving && !isAutosaving) { 7470 /* translators: button label text should, if possible, be under 16 characters. */ 7471 return Object(external_wp_i18n_["__"])('Scheduling…'); 7472 } 7473 7474 if (!hasPublishAction) { 7475 return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Submit for Review…') : Object(external_wp_i18n_["__"])('Submit for Review'); 7476 } else if (isPublished) { 7477 return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Update…') : Object(external_wp_i18n_["__"])('Update'); 7478 } else if (isBeingScheduled) { 7479 return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Schedule'); 7480 } 7481 7482 return Object(external_wp_i18n_["__"])('Publish'); 7483 } 7484 /* harmony default export */ var post_publish_button_label = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { 7485 forceIsSaving 7486 }) => { 7487 const { 7488 isCurrentPostPublished, 7489 isEditedPostBeingScheduled, 7490 isSavingPost, 7491 isPublishingPost, 7492 getCurrentPost, 7493 getCurrentPostType, 7494 isAutosavingPost 7495 } = select('core/editor'); 7496 return { 7497 isPublished: isCurrentPostPublished(), 7498 isBeingScheduled: isEditedPostBeingScheduled(), 7499 isSaving: forceIsSaving || isSavingPost(), 7500 isPublishing: isPublishingPost(), 7501 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 7502 postType: getCurrentPostType(), 7503 isAutosaving: isAutosavingPost() 7504 }; 7505 })])(PublishButtonLabel)); 7506 7507 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js 7508 7509 7510 7511 /** 7512 * External dependencies 7513 */ 7514 7515 7516 /** 7517 * WordPress dependencies 7518 */ 7519 7520 7521 7522 7523 7524 7525 /** 7526 * Internal dependencies 7527 */ 7528 7529 7530 class post_publish_button_PostPublishButton extends external_wp_element_["Component"] { 7531 constructor(props) { 7532 super(props); 7533 this.buttonNode = Object(external_wp_element_["createRef"])(); 7534 this.createOnClick = this.createOnClick.bind(this); 7535 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); 7536 this.state = { 7537 entitiesSavedStatesCallback: false 7538 }; 7539 } 7540 7541 componentDidMount() { 7542 if (this.props.focusOnMount) { 7543 this.buttonNode.current.focus(); 7544 } 7545 } 7546 7547 createOnClick(callback) { 7548 return (...args) => { 7549 const { 7550 hasNonPostEntityChanges 7551 } = this.props; 7552 7553 if (hasNonPostEntityChanges) { 7554 // The modal for multiple entity saving will open, 7555 // hold the callback for saving/publishing the post 7556 // so that we can call it if the post entity is checked. 7557 this.setState({ 7558 entitiesSavedStatesCallback: () => callback(...args) 7559 }); // Open the save panel by setting its callback. 7560 // To set a function on the useState hook, we must set it 7561 // with another function (() => myFunction). Passing the 7562 // function on its own will cause an error when called. 7563 7564 this.props.setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates); 7565 return external_lodash_["noop"]; 7566 } 7567 7568 return callback(...args); 7569 }; 7570 } 7571 7572 closeEntitiesSavedStates(savedEntities) { 7573 const { 7574 postType, 7575 postId 7576 } = this.props; 7577 const { 7578 entitiesSavedStatesCallback 7579 } = this.state; 7580 this.setState({ 7581 entitiesSavedStatesCallback: false 7582 }, () => { 7583 if (savedEntities && Object(external_lodash_["some"])(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { 7584 // The post entity was checked, call the held callback from `createOnClick`. 7585 entitiesSavedStatesCallback(); 7586 } 7587 }); 7588 } 7589 7590 render() { 7591 const { 7592 forceIsDirty, 7593 forceIsSaving, 7594 hasPublishAction, 7595 isBeingScheduled, 7596 isOpen, 7597 isPostSavingLocked, 7598 isPublishable, 7599 isPublished, 7600 isSaveable, 7601 isSaving, 7602 isAutoSaving, 7603 isToggle, 7604 onSave, 7605 onStatusChange, 7606 onSubmit = external_lodash_["noop"], 7607 onToggle, 7608 visibility, 7609 hasNonPostEntityChanges 7610 } = this.props; 7611 const isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty; 7612 const isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty; 7613 let publishStatus; 7614 7615 if (!hasPublishAction) { 7616 publishStatus = 'pending'; 7617 } else if (visibility === 'private') { 7618 publishStatus = 'private'; 7619 } else if (isBeingScheduled) { 7620 publishStatus = 'future'; 7621 } else { 7622 publishStatus = 'publish'; 7623 } 7624 7625 const onClickButton = () => { 7626 if (isButtonDisabled) { 7627 return; 7628 } 7629 7630 onSubmit(); 7631 onStatusChange(publishStatus); 7632 onSave(); 7633 }; 7634 7635 const onClickToggle = () => { 7636 if (isToggleDisabled) { 7637 return; 7638 } 7639 7640 onToggle(); 7641 }; 7642 7643 const buttonProps = { 7644 'aria-disabled': isButtonDisabled && !hasNonPostEntityChanges, 7645 className: 'editor-post-publish-button', 7646 isBusy: !isAutoSaving && isSaving && isPublished, 7647 isPrimary: true, 7648 onClick: this.createOnClick(onClickButton) 7649 }; 7650 const toggleProps = { 7651 'aria-disabled': isToggleDisabled && !hasNonPostEntityChanges, 7652 'aria-expanded': isOpen, 7653 className: 'editor-post-publish-panel__toggle', 7654 isBusy: isSaving && isPublished, 7655 isPrimary: true, 7656 onClick: this.createOnClick(onClickToggle) 7657 }; 7658 const toggleChildren = isBeingScheduled ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Publish'); 7659 const buttonChildren = Object(external_wp_element_["createElement"])(post_publish_button_label, { 7660 forceIsSaving: forceIsSaving, 7661 hasNonPostEntityChanges: hasNonPostEntityChanges 7662 }); 7663 const componentProps = isToggle ? toggleProps : buttonProps; 7664 const componentChildren = isToggle ? toggleChildren : buttonChildren; 7665 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ 7666 ref: this.buttonNode 7667 }, componentProps, { 7668 className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', { 7669 'has-changes-dot': hasNonPostEntityChanges 7670 }) 7671 }), componentChildren)); 7672 } 7673 7674 } 7675 /* harmony default export */ var post_publish_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 7676 const { 7677 isSavingPost, 7678 isAutosavingPost, 7679 isEditedPostBeingScheduled, 7680 getEditedPostVisibility, 7681 isCurrentPostPublished, 7682 isEditedPostSaveable, 7683 isEditedPostPublishable, 7684 isPostSavingLocked, 7685 getCurrentPost, 7686 getCurrentPostType, 7687 getCurrentPostId, 7688 hasNonPostEntityChanges 7689 } = select('core/editor'); 7690 7691 const _isAutoSaving = isAutosavingPost(); 7692 7693 return { 7694 isSaving: isSavingPost() || _isAutoSaving, 7695 isAutoSaving: _isAutoSaving, 7696 isBeingScheduled: isEditedPostBeingScheduled(), 7697 visibility: getEditedPostVisibility(), 7698 isSaveable: isEditedPostSaveable(), 7699 isPostSavingLocked: isPostSavingLocked(), 7700 isPublishable: isEditedPostPublishable(), 7701 isPublished: isCurrentPostPublished(), 7702 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 7703 postType: getCurrentPostType(), 7704 postId: getCurrentPostId(), 7705 hasNonPostEntityChanges: hasNonPostEntityChanges() 7706 }; 7707 }), Object(external_wp_data_["withDispatch"])(dispatch => { 7708 const { 7709 editPost, 7710 savePost 7711 } = dispatch('core/editor'); 7712 return { 7713 onStatusChange: status => editPost({ 7714 status 7715 }, { 7716 undoIgnore: true 7717 }), 7718 onSave: savePost 7719 }; 7720 })])(post_publish_button_PostPublishButton)); 7721 7722 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 7723 var close_small = __webpack_require__("bWcr"); 7724 7725 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js 7726 var wordpress = __webpack_require__("wduq"); 7727 7728 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js 7729 /** 7730 * WordPress dependencies 7731 */ 7732 7733 const visibilityOptions = [{ 7734 value: 'public', 7735 label: Object(external_wp_i18n_["__"])('Public'), 7736 info: Object(external_wp_i18n_["__"])('Visible to everyone.') 7737 }, { 7738 value: 'private', 7739 label: Object(external_wp_i18n_["__"])('Private'), 7740 info: Object(external_wp_i18n_["__"])('Only visible to site admins and editors.') 7741 }, { 7742 value: 'password', 7743 label: Object(external_wp_i18n_["__"])('Password Protected'), 7744 info: Object(external_wp_i18n_["__"])('Protected with a password you choose. Only those with the password can view this post.') 7745 }]; 7746 7747 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js 7748 7749 7750 /** 7751 * WordPress dependencies 7752 */ 7753 7754 7755 7756 7757 7758 /** 7759 * Internal dependencies 7760 */ 7761 7762 7763 class post_visibility_PostVisibility extends external_wp_element_["Component"] { 7764 constructor(props) { 7765 super(...arguments); 7766 this.setPublic = this.setPublic.bind(this); 7767 this.setPrivate = this.setPrivate.bind(this); 7768 this.setPasswordProtected = this.setPasswordProtected.bind(this); 7769 this.updatePassword = this.updatePassword.bind(this); 7770 this.state = { 7771 hasPassword: !!props.password 7772 }; 7773 } 7774 7775 setPublic() { 7776 const { 7777 visibility, 7778 onUpdateVisibility, 7779 status 7780 } = this.props; 7781 onUpdateVisibility(visibility === 'private' ? 'draft' : status); 7782 this.setState({ 7783 hasPassword: false 7784 }); 7785 } 7786 7787 setPrivate() { 7788 if ( // eslint-disable-next-line no-alert 7789 !window.confirm(Object(external_wp_i18n_["__"])('Would you like to privately publish this post now?'))) { 7790 return; 7791 } 7792 7793 const { 7794 onUpdateVisibility, 7795 onSave 7796 } = this.props; 7797 onUpdateVisibility('private'); 7798 this.setState({ 7799 hasPassword: false 7800 }); 7801 onSave(); 7802 } 7803 7804 setPasswordProtected() { 7805 const { 7806 visibility, 7807 onUpdateVisibility, 7808 status, 7809 password 7810 } = this.props; 7811 onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || ''); 7812 this.setState({ 7813 hasPassword: true 7814 }); 7815 } 7816 7817 updatePassword(event) { 7818 const { 7819 status, 7820 onUpdateVisibility 7821 } = this.props; 7822 onUpdateVisibility(status, event.target.value); 7823 } 7824 7825 render() { 7826 const { 7827 visibility, 7828 password, 7829 instanceId 7830 } = this.props; 7831 const visibilityHandlers = { 7832 public: { 7833 onSelect: this.setPublic, 7834 checked: visibility === 'public' && !this.state.hasPassword 7835 }, 7836 private: { 7837 onSelect: this.setPrivate, 7838 checked: visibility === 'private' 7839 }, 7840 password: { 7841 onSelect: this.setPasswordProtected, 7842 checked: this.state.hasPassword 7843 } 7844 }; 7845 return [Object(external_wp_element_["createElement"])("fieldset", { 7846 key: "visibility-selector", 7847 className: "editor-post-visibility__dialog-fieldset" 7848 }, Object(external_wp_element_["createElement"])("legend", { 7849 className: "editor-post-visibility__dialog-legend" 7850 }, Object(external_wp_i18n_["__"])('Post Visibility')), visibilityOptions.map(({ 7851 value, 7852 label, 7853 info 7854 }) => Object(external_wp_element_["createElement"])("div", { 7855 key: value, 7856 className: "editor-post-visibility__choice" 7857 }, Object(external_wp_element_["createElement"])("input", { 7858 type: "radio", 7859 name: `editor-post-visibility__setting-${instanceId}`, 7860 value: value, 7861 onChange: visibilityHandlers[value].onSelect, 7862 checked: visibilityHandlers[value].checked, 7863 id: `editor-post-${value}-${instanceId}`, 7864 "aria-describedby": `editor-post-${value}-${instanceId}-description`, 7865 className: "editor-post-visibility__dialog-radio" 7866 }), Object(external_wp_element_["createElement"])("label", { 7867 htmlFor: `editor-post-${value}-${instanceId}`, 7868 className: "editor-post-visibility__dialog-label" 7869 }, label), Object(external_wp_element_["createElement"])("p", { 7870 id: `editor-post-${value}-${instanceId}-description`, 7871 className: "editor-post-visibility__dialog-info" 7872 }, info)))), this.state.hasPassword && Object(external_wp_element_["createElement"])("div", { 7873 className: "editor-post-visibility__dialog-password", 7874 key: "password-selector" 7875 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 7876 as: "label", 7877 htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}` 7878 }, Object(external_wp_i18n_["__"])('Create password')), Object(external_wp_element_["createElement"])("input", { 7879 className: "editor-post-visibility__dialog-password-input", 7880 id: `editor-post-visibility__dialog-password-input-${instanceId}`, 7881 type: "text", 7882 onChange: this.updatePassword, 7883 value: password, 7884 placeholder: Object(external_wp_i18n_["__"])('Use a secure password') 7885 }))]; 7886 } 7887 7888 } 7889 /* harmony default export */ var post_visibility = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 7890 const { 7891 getEditedPostAttribute, 7892 getEditedPostVisibility 7893 } = select('core/editor'); 7894 return { 7895 status: getEditedPostAttribute('status'), 7896 visibility: getEditedPostVisibility(), 7897 password: getEditedPostAttribute('password') 7898 }; 7899 }), Object(external_wp_data_["withDispatch"])(dispatch => { 7900 const { 7901 savePost, 7902 editPost 7903 } = dispatch('core/editor'); 7904 return { 7905 onSave: savePost, 7906 7907 onUpdateVisibility(status, password = '') { 7908 editPost({ 7909 status, 7910 password 7911 }); 7912 } 7913 7914 }; 7915 }), external_wp_compose_["withInstanceId"]])(post_visibility_PostVisibility)); 7916 7917 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js 7918 /** 7919 * External dependencies 7920 */ 7921 7922 /** 7923 * WordPress dependencies 7924 */ 7925 7926 7927 /** 7928 * Internal dependencies 7929 */ 7930 7931 7932 7933 function PostVisibilityLabel({ 7934 visibility 7935 }) { 7936 const getVisibilityLabel = () => Object(external_lodash_["find"])(visibilityOptions, { 7937 value: visibility 7938 }).label; 7939 7940 return getVisibilityLabel(visibility); 7941 } 7942 7943 /* harmony default export */ var post_visibility_label = (Object(external_wp_data_["withSelect"])(select => ({ 7944 visibility: select('core/editor').getEditedPostVisibility() 7945 }))(PostVisibilityLabel)); 7946 7947 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js 7948 7949 7950 /** 7951 * WordPress dependencies 7952 */ 7953 7954 7955 7956 7957 7958 /** 7959 * Internal dependencies 7960 */ 7961 7962 7963 7964 function getDayOfTheMonth(date = new Date(), firstDay = true) { 7965 const d = new Date(date); 7966 return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString(); 7967 } 7968 7969 function PostSchedule() { 7970 const { 7971 postDate, 7972 postType 7973 } = Object(external_wp_data_["useSelect"])(select => ({ 7974 postDate: select(store).getEditedPostAttribute('date'), 7975 postType: select(store).getCurrentPostType() 7976 }), []); 7977 const { 7978 editPost 7979 } = Object(external_wp_data_["useDispatch"])(store); 7980 7981 const onUpdateDate = date => editPost({ 7982 date 7983 }); 7984 7985 const [previewedMonth, setPreviewedMonth] = Object(external_wp_element_["useState"])(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts. 7986 7987 const eventsByPostType = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntityRecords('postType', postType, { 7988 status: 'publish,future', 7989 after: getDayOfTheMonth(previewedMonth), 7990 before: getDayOfTheMonth(previewedMonth, false), 7991 exclude: [select(store).getCurrentPostId()] 7992 }), [previewedMonth, postType]); 7993 const events = Object(external_wp_element_["useMemo"])(() => (eventsByPostType || []).map(({ 7994 title, 7995 type, 7996 date: eventDate 7997 }) => ({ 7998 title: title === null || title === void 0 ? void 0 : title.rendered, 7999 type, 8000 date: new Date(eventDate) 8001 })), [eventsByPostType]); 8002 const ref = Object(external_wp_element_["useRef"])(); 8003 8004 const settings = Object(external_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format 8005 // We also make sure this a is not escaped by a "/" 8006 8007 8008 const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a 8009 .replace(/\\\\/g, '') // Replace "//" with empty strings 8010 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash 8011 ); 8012 8013 function onChange(newDate) { 8014 onUpdateDate(newDate); 8015 const { 8016 ownerDocument 8017 } = ref.current; 8018 ownerDocument.activeElement.blur(); 8019 } 8020 8021 return Object(external_wp_element_["createElement"])(external_wp_components_["DateTimePicker"], { 8022 ref: ref, 8023 currentDate: postDate, 8024 onChange: onChange, 8025 is12Hour: is12HourTime, 8026 events: events, 8027 onMonthPreviewed: setPreviewedMonth 8028 }); 8029 } 8030 8031 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js 8032 /** 8033 * WordPress dependencies 8034 */ 8035 8036 8037 8038 function PostScheduleLabel({ 8039 date, 8040 isFloating 8041 }) { 8042 const settings = Object(external_wp_date_["__experimentalGetSettings"])(); 8043 8044 return date && !isFloating ? Object(external_wp_date_["format"])(`${settings.formats.date} ${settings.formats.time}`, date) : Object(external_wp_i18n_["__"])('Immediately'); 8045 } 8046 /* harmony default export */ var post_schedule_label = (Object(external_wp_data_["withSelect"])(select => { 8047 return { 8048 date: select('core/editor').getEditedPostAttribute('date'), 8049 isFloating: select('core/editor').isEditedPostDateFloating() 8050 }; 8051 })(PostScheduleLabel)); 8052 8053 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js 8054 8055 8056 /** 8057 * External dependencies 8058 */ 8059 8060 /** 8061 * WordPress dependencies 8062 */ 8063 8064 8065 8066 8067 /** 8068 * Internal dependencies 8069 */ 8070 8071 8072 const MAX_MOST_USED_TERMS = 10; 8073 const DEFAULT_QUERY = { 8074 per_page: MAX_MOST_USED_TERMS, 8075 orderby: 'count', 8076 order: 'desc', 8077 hide_empty: true, 8078 _fields: 'id,name,count' 8079 }; 8080 function MostUsedTerms({ 8081 onSelect, 8082 taxonomy 8083 }) { 8084 const { 8085 _terms, 8086 showTerms 8087 } = Object(external_wp_data_["useSelect"])(select => { 8088 const mostUsedTerms = select(external_wp_coreData_["store"]).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); 8089 return { 8090 _terms: mostUsedTerms, 8091 showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MAX_MOST_USED_TERMS 8092 }; 8093 }, []); 8094 8095 if (!showTerms) { 8096 return null; 8097 } 8098 8099 const terms = unescapeTerms(_terms); 8100 const label = Object(external_lodash_["get"])(taxonomy, ['labels', 'most_used']); 8101 return Object(external_wp_element_["createElement"])("div", { 8102 className: "editor-post-taxonomies__flat-term-most-used" 8103 }, Object(external_wp_element_["createElement"])("h3", { 8104 className: "editor-post-taxonomies__flat-term-most-used-label" 8105 }, label), Object(external_wp_element_["createElement"])("ul", { 8106 role: "list", 8107 className: "editor-post-taxonomies__flat-term-most-used-list" 8108 }, terms.map(term => Object(external_wp_element_["createElement"])("li", { 8109 key: term.id 8110 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 8111 isLink: true, 8112 onClick: () => onSelect(term) 8113 }, term.name))))); 8114 } 8115 8116 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js 8117 8118 8119 /** 8120 * External dependencies 8121 */ 8122 8123 /** 8124 * WordPress dependencies 8125 */ 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 /** 8136 * Internal dependencies 8137 */ 8138 8139 8140 8141 8142 /** 8143 * Module constants 8144 */ 8145 8146 const MAX_TERMS_SUGGESTIONS = 20; 8147 const flat_term_selector_DEFAULT_QUERY = { 8148 per_page: MAX_TERMS_SUGGESTIONS, 8149 orderby: 'count', 8150 order: 'desc', 8151 _fields: 'id,name,count' 8152 }; 8153 8154 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); 8155 8156 const termNamesToIds = (names, terms) => { 8157 return names.map(termName => Object(external_lodash_["find"])(terms, term => isSameTermName(term.name, termName)).id); 8158 }; 8159 8160 class flat_term_selector_FlatTermSelector extends external_wp_element_["Component"] { 8161 constructor() { 8162 super(...arguments); 8163 this.onChange = this.onChange.bind(this); 8164 this.searchTerms = Object(external_lodash_["debounce"])(this.searchTerms.bind(this), 500); 8165 this.findOrCreateTerm = this.findOrCreateTerm.bind(this); 8166 this.appendTerm = this.appendTerm.bind(this); 8167 this.state = { 8168 loading: !Object(external_lodash_["isEmpty"])(this.props.terms), 8169 availableTerms: [], 8170 selectedTerms: [] 8171 }; 8172 } 8173 8174 componentDidMount() { 8175 if (!Object(external_lodash_["isEmpty"])(this.props.terms)) { 8176 this.initRequest = this.fetchTerms({ 8177 include: this.props.terms.join(','), 8178 per_page: -1 8179 }); 8180 this.initRequest.then(() => { 8181 this.setState({ 8182 loading: false 8183 }); 8184 }, xhr => { 8185 if (xhr.statusText === 'abort') { 8186 return; 8187 } 8188 8189 this.setState({ 8190 loading: false 8191 }); 8192 }); 8193 } 8194 } 8195 8196 componentWillUnmount() { 8197 Object(external_lodash_["invoke"])(this.initRequest, ['abort']); 8198 Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); 8199 } 8200 8201 componentDidUpdate(prevProps) { 8202 if (prevProps.terms !== this.props.terms) { 8203 this.updateSelectedTerms(this.props.terms); 8204 } 8205 } 8206 8207 fetchTerms(params = {}) { 8208 const { 8209 taxonomy 8210 } = this.props; 8211 const query = { ...flat_term_selector_DEFAULT_QUERY, 8212 ...params 8213 }; 8214 const request = external_wp_apiFetch_default()({ 8215 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, query) 8216 }); 8217 request.then(unescapeTerms).then(terms => { 8218 this.setState(state => ({ 8219 availableTerms: state.availableTerms.concat(terms.filter(term => !Object(external_lodash_["find"])(state.availableTerms, availableTerm => availableTerm.id === term.id))) 8220 })); 8221 this.updateSelectedTerms(this.props.terms); 8222 }); 8223 return request; 8224 } 8225 8226 updateSelectedTerms(terms = []) { 8227 const selectedTerms = terms.reduce((accumulator, termId) => { 8228 const termObject = Object(external_lodash_["find"])(this.state.availableTerms, term => term.id === termId); 8229 8230 if (termObject) { 8231 accumulator.push(termObject.name); 8232 } 8233 8234 return accumulator; 8235 }, []); 8236 this.setState({ 8237 selectedTerms 8238 }); 8239 } 8240 8241 findOrCreateTerm(termName) { 8242 const { 8243 taxonomy 8244 } = this.props; 8245 const termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists. 8246 8247 return external_wp_apiFetch_default()({ 8248 path: `/wp/v2/${taxonomy.rest_base}`, 8249 method: 'POST', 8250 data: { 8251 name: termNameEscaped 8252 } 8253 }).catch(error => { 8254 const errorCode = error.code; 8255 8256 if (errorCode === 'term_exists') { 8257 // If the terms exist, fetch it instead of creating a new one. 8258 this.addRequest = external_wp_apiFetch_default()({ 8259 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...flat_term_selector_DEFAULT_QUERY, 8260 search: termNameEscaped 8261 }) 8262 }).then(unescapeTerms); 8263 return this.addRequest.then(searchResult => { 8264 return Object(external_lodash_["find"])(searchResult, result => isSameTermName(result.name, termName)); 8265 }); 8266 } 8267 8268 return Promise.reject(error); 8269 }).then(unescapeTerm); 8270 } 8271 8272 onChange(termNames) { 8273 const uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, term => term.toLowerCase()); 8274 this.setState({ 8275 selectedTerms: uniqueTerms 8276 }); 8277 const newTermNames = uniqueTerms.filter(termName => !Object(external_lodash_["find"])(this.state.availableTerms, term => isSameTermName(term.name, termName))); 8278 8279 if (newTermNames.length === 0) { 8280 return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, this.state.availableTerms), this.props.taxonomy.rest_base); 8281 } 8282 8283 Promise.all(newTermNames.map(this.findOrCreateTerm)).then(newTerms => { 8284 const newAvailableTerms = this.state.availableTerms.concat(newTerms); 8285 this.setState({ 8286 availableTerms: newAvailableTerms 8287 }); 8288 return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms), this.props.taxonomy.rest_base); 8289 }); 8290 } 8291 8292 searchTerms(search = '') { 8293 Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); 8294 8295 if (search.length >= 3) { 8296 this.searchRequest = this.fetchTerms({ 8297 search 8298 }); 8299 } 8300 } 8301 8302 appendTerm(newTerm) { 8303 const { 8304 onUpdateTerms, 8305 taxonomy, 8306 terms = [], 8307 slug, 8308 speak 8309 } = this.props; 8310 8311 if (terms.includes(newTerm.id)) { 8312 return; 8313 } 8314 8315 const newTerms = [...terms, newTerm.id]; 8316 const termAddedMessage = Object(external_wp_i18n_["sprintf"])( 8317 /* translators: %s: term name. */ 8318 Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term'))); 8319 speak(termAddedMessage, 'assertive'); 8320 this.setState({ 8321 availableTerms: [...this.state.availableTerms, newTerm] 8322 }); 8323 onUpdateTerms(newTerms, taxonomy.rest_base); 8324 } 8325 8326 render() { 8327 const { 8328 slug, 8329 taxonomy, 8330 hasAssignAction 8331 } = this.props; 8332 8333 if (!hasAssignAction) { 8334 return null; 8335 } 8336 8337 const { 8338 loading, 8339 availableTerms, 8340 selectedTerms 8341 } = this.state; 8342 const termNames = availableTerms.map(term => term.name); 8343 const newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Add new tag') : Object(external_wp_i18n_["__"])('Add new Term')); 8344 const singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term')); 8345 const termAddedLabel = Object(external_wp_i18n_["sprintf"])( 8346 /* translators: %s: term name. */ 8347 Object(external_wp_i18n_["_x"])('%s added', 'term'), singularName); 8348 const termRemovedLabel = Object(external_wp_i18n_["sprintf"])( 8349 /* translators: %s: term name. */ 8350 Object(external_wp_i18n_["_x"])('%s removed', 'term'), singularName); 8351 const removeTermLabel = Object(external_wp_i18n_["sprintf"])( 8352 /* translators: %s: term name. */ 8353 Object(external_wp_i18n_["_x"])('Remove %s', 'term'), singularName); 8354 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["FormTokenField"], { 8355 value: selectedTerms, 8356 suggestions: termNames, 8357 onChange: this.onChange, 8358 onInputChange: this.searchTerms, 8359 maxSuggestions: MAX_TERMS_SUGGESTIONS, 8360 disabled: loading, 8361 label: newTermLabel, 8362 messages: { 8363 added: termAddedLabel, 8364 removed: termRemovedLabel, 8365 remove: removeTermLabel 8366 } 8367 }), Object(external_wp_element_["createElement"])(MostUsedTerms, { 8368 taxonomy: taxonomy, 8369 onSelect: this.appendTerm 8370 })); 8371 } 8372 8373 } 8374 8375 /* harmony default export */ var flat_term_selector = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, { 8376 slug 8377 }) => { 8378 const { 8379 getCurrentPost 8380 } = select(store); 8381 const { 8382 getTaxonomy 8383 } = select(external_wp_coreData_["store"]); 8384 const taxonomy = getTaxonomy(slug); 8385 return { 8386 hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, 8387 hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, 8388 terms: taxonomy ? select(store).getEditedPostAttribute(taxonomy.rest_base) : [], 8389 taxonomy 8390 }; 8391 }), Object(external_wp_data_["withDispatch"])(dispatch => { 8392 return { 8393 onUpdateTerms(terms, restBase) { 8394 dispatch(store).editPost({ 8395 [restBase]: terms 8396 }); 8397 } 8398 8399 }; 8400 }), external_wp_components_["withSpokenMessages"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType'))(flat_term_selector_FlatTermSelector)); 8401 8402 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js 8403 8404 8405 /** 8406 * External dependencies 8407 */ 8408 8409 /** 8410 * WordPress dependencies 8411 */ 8412 8413 8414 8415 8416 8417 8418 /** 8419 * Internal dependencies 8420 */ 8421 8422 8423 8424 const TagsPanel = () => { 8425 const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", { 8426 className: "editor-post-publish-panel__link", 8427 key: "label" 8428 }, Object(external_wp_i18n_["__"])('Add tags'))]; 8429 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 8430 initialOpen: false, 8431 title: panelBodyTitle 8432 }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), Object(external_wp_element_["createElement"])(flat_term_selector, { 8433 slug: 'post_tag' 8434 })); 8435 }; 8436 8437 class maybe_tags_panel_MaybeTagsPanel extends external_wp_element_["Component"] { 8438 constructor(props) { 8439 super(props); 8440 this.state = { 8441 hadTagsWhenOpeningThePanel: props.hasTags 8442 }; 8443 } 8444 /* 8445 * We only want to show the tag panel if the post didn't have 8446 * any tags when the user hit the Publish button. 8447 * 8448 * We can't use the prop.hasTags because it'll change to true 8449 * if the user adds a new tag within the pre-publish panel. 8450 * This would force a re-render and a new prop.hasTags check, 8451 * hiding this panel and keeping the user from adding 8452 * more than one tag. 8453 */ 8454 8455 8456 render() { 8457 if (!this.state.hadTagsWhenOpeningThePanel) { 8458 return Object(external_wp_element_["createElement"])(TagsPanel, null); 8459 } 8460 8461 return null; 8462 } 8463 8464 } 8465 8466 /* harmony default export */ var maybe_tags_panel = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => { 8467 const postType = select('core/editor').getCurrentPostType(); 8468 const tagsTaxonomy = select('core').getTaxonomy('post_tag'); 8469 const tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base); 8470 return { 8471 areTagsFetched: tagsTaxonomy !== undefined, 8472 isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, type => type === postType), 8473 hasTags: tags && tags.length 8474 }; 8475 }), Object(external_wp_compose_["ifCondition"])(({ 8476 areTagsFetched, 8477 isPostTypeSupported 8478 }) => isPostTypeSupported && areTagsFetched))(maybe_tags_panel_MaybeTagsPanel)); 8479 8480 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js 8481 8482 8483 /** 8484 * External dependencies 8485 */ 8486 8487 /** 8488 * WordPress dependencies 8489 */ 8490 8491 8492 8493 8494 /** 8495 * Internal dependencies 8496 */ 8497 8498 8499 8500 const getSuggestion = (supportedFormats, suggestedPostFormat) => { 8501 const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id)); 8502 return Object(external_lodash_["find"])(formats, format => format.id === suggestedPostFormat); 8503 }; 8504 8505 const PostFormatSuggestion = ({ 8506 suggestedPostFormat, 8507 suggestionText, 8508 onUpdatePostFormat 8509 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 8510 isLink: true, 8511 onClick: () => onUpdatePostFormat(suggestedPostFormat) 8512 }, suggestionText); 8513 8514 function PostFormatPanel() { 8515 const { 8516 currentPostFormat, 8517 suggestion 8518 } = Object(external_wp_data_["useSelect"])(select => { 8519 const { 8520 getEditedPostAttribute, 8521 getSuggestedPostFormat 8522 } = select('core/editor'); 8523 const supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); 8524 return { 8525 currentPostFormat: getEditedPostAttribute('format'), 8526 suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) 8527 }; 8528 }, []); 8529 const { 8530 editPost 8531 } = Object(external_wp_data_["useDispatch"])('core/editor'); 8532 8533 const onUpdatePostFormat = format => editPost({ 8534 format 8535 }); 8536 8537 const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", { 8538 className: "editor-post-publish-panel__link", 8539 key: "label" 8540 }, Object(external_wp_i18n_["__"])('Use a post format'))]; 8541 8542 if (!suggestion || suggestion.id === currentPostFormat) { 8543 return null; 8544 } 8545 8546 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 8547 initialOpen: false, 8548 title: panelBodyTitle 8549 }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_element_["createElement"])(PostFormatSuggestion, { 8550 onUpdatePostFormat: onUpdatePostFormat, 8551 suggestedPostFormat: suggestion.id, 8552 suggestionText: Object(external_wp_i18n_["sprintf"])( 8553 /* translators: %s: post format */ 8554 Object(external_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption) 8555 }))); 8556 } 8557 8558 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js 8559 8560 8561 /** 8562 * External dependencies 8563 */ 8564 8565 /** 8566 * WordPress dependencies 8567 */ 8568 8569 8570 8571 8572 8573 8574 /** 8575 * Internal dependencies 8576 */ 8577 8578 8579 8580 8581 8582 8583 8584 8585 function PostPublishPanelPrepublish({ 8586 children 8587 }) { 8588 const { 8589 isBeingScheduled, 8590 isRequestingSiteIcon, 8591 hasPublishAction, 8592 siteIconUrl, 8593 siteTitle, 8594 siteHome 8595 } = Object(external_wp_data_["useSelect"])(select => { 8596 const { 8597 isResolving 8598 } = select('core/data'); 8599 const { 8600 getCurrentPost, 8601 isEditedPostBeingScheduled 8602 } = select('core/editor'); 8603 const { 8604 getEntityRecord 8605 } = select('core'); 8606 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 8607 return { 8608 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 8609 isBeingScheduled: isEditedPostBeingScheduled(), 8610 isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]), 8611 siteIconUrl: siteData.site_icon_url, 8612 siteTitle: siteData.name, 8613 siteHome: siteData.home && Object(external_wp_url_["filterURLForDisplay"])(siteData.home) 8614 }; 8615 }, []); 8616 let siteIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], { 8617 className: "components-site-icon", 8618 size: "36px", 8619 icon: wordpress["a" /* default */] 8620 }); 8621 8622 if (siteIconUrl) { 8623 siteIcon = Object(external_wp_element_["createElement"])("img", { 8624 alt: Object(external_wp_i18n_["__"])('Site Icon'), 8625 className: "components-site-icon", 8626 src: siteIconUrl 8627 }); 8628 } 8629 8630 if (isRequestingSiteIcon) { 8631 siteIcon = null; 8632 } 8633 8634 let prePublishTitle, prePublishBodyText; 8635 8636 if (!hasPublishAction) { 8637 prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to submit for review?'); 8638 prePublishBodyText = Object(external_wp_i18n_["__"])('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'); 8639 } else if (isBeingScheduled) { 8640 prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to schedule?'); 8641 prePublishBodyText = Object(external_wp_i18n_["__"])('Your work will be published at the specified date and time.'); 8642 } else { 8643 prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to publish?'); 8644 prePublishBodyText = Object(external_wp_i18n_["__"])('Double-check your settings before publishing.'); 8645 } 8646 8647 return Object(external_wp_element_["createElement"])("div", { 8648 className: "editor-post-publish-panel__prepublish" 8649 }, Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("strong", null, prePublishTitle)), Object(external_wp_element_["createElement"])("p", null, prePublishBodyText), Object(external_wp_element_["createElement"])("div", { 8650 className: "components-site-card" 8651 }, siteIcon, Object(external_wp_element_["createElement"])("div", { 8652 className: "components-site-info" 8653 }, Object(external_wp_element_["createElement"])("span", { 8654 className: "components-site-name" 8655 }, siteTitle || Object(external_wp_i18n_["__"])('(Untitled)')), Object(external_wp_element_["createElement"])("span", { 8656 className: "components-site-home" 8657 }, siteHome))), hasPublishAction && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 8658 initialOpen: false, 8659 title: [Object(external_wp_i18n_["__"])('Visibility:'), Object(external_wp_element_["createElement"])("span", { 8660 className: "editor-post-publish-panel__link", 8661 key: "label" 8662 }, Object(external_wp_element_["createElement"])(post_visibility_label, null))] 8663 }, Object(external_wp_element_["createElement"])(post_visibility, null)), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 8664 initialOpen: false, 8665 title: [Object(external_wp_i18n_["__"])('Publish:'), Object(external_wp_element_["createElement"])("span", { 8666 className: "editor-post-publish-panel__link", 8667 key: "label" 8668 }, Object(external_wp_element_["createElement"])(post_schedule_label, null))] 8669 }, Object(external_wp_element_["createElement"])(PostSchedule, null))), Object(external_wp_element_["createElement"])(PostFormatPanel, null), Object(external_wp_element_["createElement"])(maybe_tags_panel, null), children); 8670 } 8671 8672 /* harmony default export */ var prepublish = (PostPublishPanelPrepublish); 8673 8674 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js 8675 8676 8677 /** 8678 * External dependencies 8679 */ 8680 8681 /** 8682 * WordPress dependencies 8683 */ 8684 8685 8686 8687 8688 8689 8690 8691 8692 /** 8693 * Internal dependencies 8694 */ 8695 8696 8697 const POSTNAME = '%postname%'; 8698 /** 8699 * Returns URL for a future post. 8700 * 8701 * @param {Object} post Post object. 8702 * 8703 * @return {string} PostPublish URL. 8704 */ 8705 8706 const getFuturePostUrl = post => { 8707 const { 8708 slug 8709 } = post; 8710 8711 if (post.permalink_template.includes(POSTNAME)) { 8712 return post.permalink_template.replace(POSTNAME, slug); 8713 } 8714 8715 return post.permalink_template; 8716 }; 8717 8718 function postpublish_CopyButton({ 8719 text, 8720 onCopy, 8721 children 8722 }) { 8723 const ref = Object(external_wp_compose_["useCopyToClipboard"])(text, onCopy); 8724 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 8725 isSecondary: true, 8726 ref: ref 8727 }, children); 8728 } 8729 8730 class postpublish_PostPublishPanelPostpublish extends external_wp_element_["Component"] { 8731 constructor() { 8732 super(...arguments); 8733 this.state = { 8734 showCopyConfirmation: false 8735 }; 8736 this.onCopy = this.onCopy.bind(this); 8737 this.onSelectInput = this.onSelectInput.bind(this); 8738 this.postLink = Object(external_wp_element_["createRef"])(); 8739 } 8740 8741 componentDidMount() { 8742 if (this.props.focusOnMount) { 8743 this.postLink.current.focus(); 8744 } 8745 } 8746 8747 componentWillUnmount() { 8748 clearTimeout(this.dismissCopyConfirmation); 8749 } 8750 8751 onCopy() { 8752 this.setState({ 8753 showCopyConfirmation: true 8754 }); 8755 clearTimeout(this.dismissCopyConfirmation); 8756 this.dismissCopyConfirmation = setTimeout(() => { 8757 this.setState({ 8758 showCopyConfirmation: false 8759 }); 8760 }, 4000); 8761 } 8762 8763 onSelectInput(event) { 8764 event.target.select(); 8765 } 8766 8767 render() { 8768 const { 8769 children, 8770 isScheduled, 8771 post, 8772 postType 8773 } = this.props; 8774 const postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']); 8775 const viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']); 8776 const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; 8777 const postPublishNonLinkHeader = isScheduled ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('is now scheduled. It will go live on'), ' ', Object(external_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_wp_i18n_["__"])('is now live.'); 8778 return Object(external_wp_element_["createElement"])("div", { 8779 className: "post-publish-panel__postpublish" 8780 }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 8781 className: "post-publish-panel__postpublish-header" 8782 }, Object(external_wp_element_["createElement"])("a", { 8783 ref: this.postLink, 8784 href: link 8785 }, Object(external_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_wp_i18n_["__"])('(no title)')), ' ', postPublishNonLinkHeader), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])("p", { 8786 className: "post-publish-panel__postpublish-subheader" 8787 }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('What’s next?'))), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 8788 className: "post-publish-panel__postpublish-post-address", 8789 readOnly: true, 8790 label: Object(external_wp_i18n_["sprintf"])( 8791 /* translators: %s: post type singular name */ 8792 Object(external_wp_i18n_["__"])('%s address'), postLabel), 8793 value: Object(external_wp_url_["safeDecodeURIComponent"])(link), 8794 onFocus: this.onSelectInput 8795 }), Object(external_wp_element_["createElement"])("div", { 8796 className: "post-publish-panel__postpublish-buttons" 8797 }, !isScheduled && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 8798 isSecondary: true, 8799 href: link 8800 }, viewPostLabel), Object(external_wp_element_["createElement"])(postpublish_CopyButton, { 8801 text: link, 8802 onCopy: this.onCopy 8803 }, this.state.showCopyConfirmation ? Object(external_wp_i18n_["__"])('Copied!') : Object(external_wp_i18n_["__"])('Copy Link')))), children); 8804 } 8805 8806 } 8807 8808 /* harmony default export */ var postpublish = (Object(external_wp_data_["withSelect"])(select => { 8809 const { 8810 getEditedPostAttribute, 8811 getCurrentPost, 8812 isCurrentPostScheduled 8813 } = select('core/editor'); 8814 const { 8815 getPostType 8816 } = select('core'); 8817 return { 8818 post: getCurrentPost(), 8819 postType: getPostType(getEditedPostAttribute('type')), 8820 isScheduled: isCurrentPostScheduled() 8821 }; 8822 })(postpublish_PostPublishPanelPostpublish)); 8823 8824 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js 8825 8826 8827 8828 /** 8829 * External dependencies 8830 */ 8831 8832 /** 8833 * WordPress dependencies 8834 */ 8835 8836 8837 8838 8839 8840 8841 8842 /** 8843 * Internal dependencies 8844 */ 8845 8846 8847 8848 8849 class post_publish_panel_PostPublishPanel extends external_wp_element_["Component"] { 8850 constructor() { 8851 super(...arguments); 8852 this.onSubmit = this.onSubmit.bind(this); 8853 } 8854 8855 componentDidUpdate(prevProps) { 8856 // Automatically collapse the publish sidebar when a post 8857 // is published and the user makes an edit. 8858 if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) { 8859 this.props.onClose(); 8860 } 8861 } 8862 8863 onSubmit() { 8864 const { 8865 onClose, 8866 hasPublishAction, 8867 isPostTypeViewable 8868 } = this.props; 8869 8870 if (!hasPublishAction || !isPostTypeViewable) { 8871 onClose(); 8872 } 8873 } 8874 8875 render() { 8876 const { 8877 forceIsDirty, 8878 forceIsSaving, 8879 isBeingScheduled, 8880 isPublished, 8881 isPublishSidebarEnabled, 8882 isScheduled, 8883 isSaving, 8884 onClose, 8885 onTogglePublishSidebar, 8886 PostPublishExtension, 8887 PrePublishExtension, 8888 ...additionalProps 8889 } = this.props; 8890 const propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); 8891 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; 8892 const isPrePublish = !isPublishedOrScheduled && !isSaving; 8893 const isPostPublish = isPublishedOrScheduled && !isSaving; 8894 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 8895 className: "editor-post-publish-panel" 8896 }, propsForPanel), Object(external_wp_element_["createElement"])("div", { 8897 className: "editor-post-publish-panel__header" 8898 }, isPostPublish ? Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 8899 onClick: onClose, 8900 icon: close_small["a" /* default */], 8901 label: Object(external_wp_i18n_["__"])('Close panel') 8902 }) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 8903 className: "editor-post-publish-panel__header-publish-button" 8904 }, Object(external_wp_element_["createElement"])(post_publish_button, { 8905 focusOnMount: true, 8906 onSubmit: this.onSubmit, 8907 forceIsDirty: forceIsDirty, 8908 forceIsSaving: forceIsSaving 8909 })), Object(external_wp_element_["createElement"])("div", { 8910 className: "editor-post-publish-panel__header-cancel-button" 8911 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 8912 onClick: onClose, 8913 isSecondary: true 8914 }, Object(external_wp_i18n_["__"])('Cancel'))))), Object(external_wp_element_["createElement"])("div", { 8915 className: "editor-post-publish-panel__content" 8916 }, isPrePublish && Object(external_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_wp_element_["createElement"])(postpublish, { 8917 focusOnMount: true 8918 }, PostPublishExtension && Object(external_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)), Object(external_wp_element_["createElement"])("div", { 8919 className: "editor-post-publish-panel__footer" 8920 }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 8921 label: Object(external_wp_i18n_["__"])('Always show pre-publish checks.'), 8922 checked: isPublishSidebarEnabled, 8923 onChange: onTogglePublishSidebar 8924 }))); 8925 } 8926 8927 } 8928 /* harmony default export */ var post_publish_panel = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 8929 const { 8930 getPostType 8931 } = select('core'); 8932 const { 8933 getCurrentPost, 8934 getEditedPostAttribute, 8935 isCurrentPostPublished, 8936 isCurrentPostScheduled, 8937 isEditedPostBeingScheduled, 8938 isEditedPostDirty, 8939 isSavingPost 8940 } = select('core/editor'); 8941 const { 8942 isPublishSidebarEnabled 8943 } = select('core/editor'); 8944 const postType = getPostType(getEditedPostAttribute('type')); 8945 return { 8946 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 8947 isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), 8948 isBeingScheduled: isEditedPostBeingScheduled(), 8949 isDirty: isEditedPostDirty(), 8950 isPublished: isCurrentPostPublished(), 8951 isPublishSidebarEnabled: isPublishSidebarEnabled(), 8952 isSaving: isSavingPost(), 8953 isScheduled: isCurrentPostScheduled() 8954 }; 8955 }), Object(external_wp_data_["withDispatch"])((dispatch, { 8956 isPublishSidebarEnabled 8957 }) => { 8958 const { 8959 disablePublishSidebar, 8960 enablePublishSidebar 8961 } = dispatch('core/editor'); 8962 return { 8963 onTogglePublishSidebar: () => { 8964 if (isPublishSidebarEnabled) { 8965 disablePublishSidebar(); 8966 } else { 8967 enablePublishSidebar(); 8968 } 8969 } 8970 }; 8971 }), external_wp_components_["withFocusReturn"], external_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel)); 8972 8973 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 8974 var build_module_icon = __webpack_require__("iClF"); 8975 8976 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js 8977 8978 8979 /** 8980 * WordPress dependencies 8981 */ 8982 8983 const cloud = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 8984 xmlns: "http://www.w3.org/2000/svg", 8985 viewBox: "0 0 24 24" 8986 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 8987 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" 8988 })); 8989 /* harmony default export */ var library_cloud = (cloud); 8990 8991 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 8992 var library_check = __webpack_require__("RMJe"); 8993 8994 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js 8995 8996 8997 /** 8998 * WordPress dependencies 8999 */ 9000 9001 const cloudUpload = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 9002 xmlns: "http://www.w3.org/2000/svg", 9003 viewBox: "0 0 24 24" 9004 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 9005 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z" 9006 })); 9007 /* harmony default export */ var cloud_upload = (cloudUpload); 9008 9009 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js 9010 9011 9012 /** 9013 * WordPress dependencies 9014 */ 9015 9016 9017 9018 9019 9020 function PostSwitchToDraftButton({ 9021 isSaving, 9022 isPublished, 9023 isScheduled, 9024 onClick 9025 }) { 9026 const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('small', '<'); 9027 9028 if (!isPublished && !isScheduled) { 9029 return null; 9030 } 9031 9032 const onSwitch = () => { 9033 let alertMessage; 9034 9035 if (isPublished) { 9036 alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unpublish this post?'); 9037 } else if (isScheduled) { 9038 alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unschedule this post?'); 9039 } // eslint-disable-next-line no-alert 9040 9041 9042 if (window.confirm(alertMessage)) { 9043 onClick(); 9044 } 9045 }; 9046 9047 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 9048 className: "editor-post-switch-to-draft", 9049 onClick: onSwitch, 9050 disabled: isSaving, 9051 isTertiary: true 9052 }, isMobileViewport ? Object(external_wp_i18n_["__"])('Draft') : Object(external_wp_i18n_["__"])('Switch to draft')); 9053 } 9054 9055 /* harmony default export */ var post_switch_to_draft_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 9056 const { 9057 isSavingPost, 9058 isCurrentPostPublished, 9059 isCurrentPostScheduled 9060 } = select('core/editor'); 9061 return { 9062 isSaving: isSavingPost(), 9063 isPublished: isCurrentPostPublished(), 9064 isScheduled: isCurrentPostScheduled() 9065 }; 9066 }), Object(external_wp_data_["withDispatch"])(dispatch => { 9067 const { 9068 editPost, 9069 savePost 9070 } = dispatch('core/editor'); 9071 return { 9072 onClick: () => { 9073 editPost({ 9074 status: 'draft' 9075 }); 9076 savePost(); 9077 } 9078 }; 9079 })])(PostSwitchToDraftButton)); 9080 9081 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js 9082 9083 9084 /** 9085 * External dependencies 9086 */ 9087 9088 /** 9089 * WordPress dependencies 9090 */ 9091 9092 9093 9094 9095 9096 9097 9098 9099 /** 9100 * Internal dependencies 9101 */ 9102 9103 9104 /** 9105 * Component showing whether the post is saved or not and providing save 9106 * buttons. 9107 * 9108 * @param {Object} props Component props. 9109 * @param {?boolean} props.forceIsDirty Whether to force the post to be marked 9110 * as dirty. 9111 * @param {?boolean} props.forceIsSaving Whether to force the post to be marked 9112 * as being saved. 9113 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons 9114 * @return {import('@wordpress/element').WPComponent} The component. 9115 */ 9116 9117 function PostSavedState({ 9118 forceIsDirty, 9119 forceIsSaving, 9120 showIconLabels = false 9121 }) { 9122 const [forceSavedMessage, setForceSavedMessage] = Object(external_wp_element_["useState"])(false); 9123 const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('small'); 9124 const { 9125 isAutosaving, 9126 isDirty, 9127 isNew, 9128 isPending, 9129 isPublished, 9130 isSaveable, 9131 isSaving, 9132 isScheduled, 9133 hasPublishAction 9134 } = Object(external_wp_data_["useSelect"])(select => { 9135 var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2; 9136 9137 const { 9138 isEditedPostNew, 9139 isCurrentPostPublished, 9140 isCurrentPostScheduled, 9141 isEditedPostDirty, 9142 isSavingPost, 9143 isEditedPostSaveable, 9144 getCurrentPost, 9145 isAutosavingPost, 9146 getEditedPostAttribute 9147 } = select('core/editor'); 9148 return { 9149 isAutosaving: isAutosavingPost(), 9150 isDirty: forceIsDirty || isEditedPostDirty(), 9151 isNew: isEditedPostNew(), 9152 isPending: 'pending' === getEditedPostAttribute('status'), 9153 isPublished: isCurrentPostPublished(), 9154 isSaving: forceIsSaving || isSavingPost(), 9155 isSaveable: isEditedPostSaveable(), 9156 isScheduled: isCurrentPostScheduled(), 9157 hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false 9158 }; 9159 }, [forceIsDirty, forceIsSaving]); 9160 const { 9161 savePost 9162 } = Object(external_wp_data_["useDispatch"])('core/editor'); 9163 const wasSaving = Object(external_wp_compose_["usePrevious"])(isSaving); 9164 Object(external_wp_element_["useEffect"])(() => { 9165 let timeoutId; 9166 9167 if (wasSaving && !isSaving) { 9168 setForceSavedMessage(true); 9169 timeoutId = setTimeout(() => { 9170 setForceSavedMessage(false); 9171 }, 1000); 9172 } 9173 9174 return () => clearTimeout(timeoutId); 9175 }, [isSaving]); 9176 9177 if (isSaving) { 9178 // TODO: Classes generation should be common across all return 9179 // paths of this function, including proper naming convention for 9180 // the "Save Draft" button. 9181 const classes = classnames_default()('editor-post-saved-state', 'is-saving', Object(external_wp_components_["__unstableGetAnimateClassName"])({ 9182 type: 'loading' 9183 }), { 9184 'is-autosaving': isAutosaving 9185 }); 9186 return Object(external_wp_element_["createElement"])("span", { 9187 className: classes 9188 }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 9189 icon: library_cloud 9190 }), isAutosaving ? Object(external_wp_i18n_["__"])('Autosaving') : Object(external_wp_i18n_["__"])('Saving')); 9191 } 9192 9193 if (isPublished || isScheduled) { 9194 return Object(external_wp_element_["createElement"])(post_switch_to_draft_button, null); 9195 } 9196 9197 if (!isSaveable) { 9198 return null; 9199 } 9200 9201 if (forceSavedMessage || !isNew && !isDirty) { 9202 return Object(external_wp_element_["createElement"])("span", { 9203 className: "editor-post-saved-state is-saved" 9204 }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 9205 icon: library_check["a" /* default */] 9206 }), Object(external_wp_i18n_["__"])('Saved')); 9207 } // Once the post has been submitted for review this button 9208 // is not needed for the contributor role. 9209 9210 9211 if (!hasPublishAction && isPending) { 9212 return null; 9213 } 9214 /* translators: button label text should, if possible, be under 16 characters. */ 9215 9216 9217 const label = isPending ? Object(external_wp_i18n_["__"])('Save as pending') : Object(external_wp_i18n_["__"])('Save draft'); 9218 /* translators: button label text should, if possible, be under 16 characters. */ 9219 9220 const shortLabel = Object(external_wp_i18n_["__"])('Save'); 9221 9222 if (!isLargeViewport) { 9223 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 9224 className: "editor-post-save-draft", 9225 label: label, 9226 onClick: () => savePost(), 9227 shortcut: external_wp_keycodes_["displayShortcut"].primary('s'), 9228 icon: cloud_upload 9229 }, showIconLabels && shortLabel); 9230 } 9231 9232 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 9233 className: "editor-post-save-draft", 9234 onClick: () => savePost(), 9235 shortcut: external_wp_keycodes_["displayShortcut"].primary('s'), 9236 isTertiary: true 9237 }, label); 9238 } 9239 9240 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js 9241 /** 9242 * External dependencies 9243 */ 9244 9245 /** 9246 * WordPress dependencies 9247 */ 9248 9249 9250 9251 function PostScheduleCheck({ 9252 hasPublishAction, 9253 children 9254 }) { 9255 if (!hasPublishAction) { 9256 return null; 9257 } 9258 9259 return children; 9260 } 9261 /* harmony default export */ var post_schedule_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 9262 const { 9263 getCurrentPost, 9264 getCurrentPostType 9265 } = select('core/editor'); 9266 return { 9267 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 9268 postType: getCurrentPostType() 9269 }; 9270 })])(PostScheduleCheck)); 9271 9272 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js 9273 9274 9275 /** 9276 * Internal dependencies 9277 */ 9278 9279 function PostSlugCheck({ 9280 children 9281 }) { 9282 return Object(external_wp_element_["createElement"])(post_type_support_check, { 9283 supportKeys: "slug" 9284 }, children); 9285 } 9286 9287 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js 9288 9289 9290 /** 9291 * WordPress dependencies 9292 */ 9293 9294 9295 9296 9297 9298 /** 9299 * Internal dependencies 9300 */ 9301 9302 9303 9304 class post_slug_PostSlug extends external_wp_element_["Component"] { 9305 constructor({ 9306 postSlug, 9307 postTitle, 9308 postID 9309 }) { 9310 super(...arguments); 9311 this.state = { 9312 editedSlug: Object(external_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID 9313 }; 9314 this.setSlug = this.setSlug.bind(this); 9315 } 9316 9317 setSlug(event) { 9318 const { 9319 postSlug, 9320 onUpdateSlug 9321 } = this.props; 9322 const { 9323 value 9324 } = event.target; 9325 const editedSlug = cleanForSlug(value); 9326 9327 if (editedSlug === postSlug) { 9328 return; 9329 } 9330 9331 onUpdateSlug(editedSlug); 9332 } 9333 9334 render() { 9335 const { 9336 instanceId 9337 } = this.props; 9338 const { 9339 editedSlug 9340 } = this.state; 9341 const inputId = 'editor-post-slug-' + instanceId; 9342 return Object(external_wp_element_["createElement"])(PostSlugCheck, null, Object(external_wp_element_["createElement"])("label", { 9343 htmlFor: inputId 9344 }, Object(external_wp_i18n_["__"])('Slug')), Object(external_wp_element_["createElement"])("input", { 9345 type: "text", 9346 id: inputId, 9347 value: editedSlug, 9348 onChange: event => this.setState({ 9349 editedSlug: event.target.value 9350 }), 9351 onBlur: this.setSlug, 9352 className: "editor-post-slug__input" 9353 })); 9354 } 9355 9356 } 9357 /* harmony default export */ var post_slug = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 9358 const { 9359 getCurrentPost, 9360 getEditedPostAttribute 9361 } = select('core/editor'); 9362 const { 9363 id 9364 } = getCurrentPost(); 9365 return { 9366 postSlug: getEditedPostAttribute('slug'), 9367 postTitle: getEditedPostAttribute('title'), 9368 postID: id 9369 }; 9370 }), Object(external_wp_data_["withDispatch"])(dispatch => { 9371 const { 9372 editPost 9373 } = dispatch('core/editor'); 9374 return { 9375 onUpdateSlug(slug) { 9376 editPost({ 9377 slug 9378 }); 9379 } 9380 9381 }; 9382 }), external_wp_compose_["withInstanceId"]])(post_slug_PostSlug)); 9383 9384 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js 9385 /** 9386 * External dependencies 9387 */ 9388 9389 /** 9390 * WordPress dependencies 9391 */ 9392 9393 9394 9395 function PostStickyCheck({ 9396 hasStickyAction, 9397 postType, 9398 children 9399 }) { 9400 if (postType !== 'post' || !hasStickyAction) { 9401 return null; 9402 } 9403 9404 return children; 9405 } 9406 /* harmony default export */ var post_sticky_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 9407 const post = select('core/editor').getCurrentPost(); 9408 return { 9409 hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false), 9410 postType: select('core/editor').getCurrentPostType() 9411 }; 9412 })])(PostStickyCheck)); 9413 9414 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js 9415 9416 9417 /** 9418 * WordPress dependencies 9419 */ 9420 9421 9422 9423 9424 /** 9425 * Internal dependencies 9426 */ 9427 9428 9429 function PostSticky({ 9430 onUpdateSticky, 9431 postSticky = false 9432 }) { 9433 return Object(external_wp_element_["createElement"])(post_sticky_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 9434 label: Object(external_wp_i18n_["__"])('Stick to the top of the blog'), 9435 checked: postSticky, 9436 onChange: () => onUpdateSticky(!postSticky) 9437 })); 9438 } 9439 /* harmony default export */ var post_sticky = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 9440 return { 9441 postSticky: select('core/editor').getEditedPostAttribute('sticky') 9442 }; 9443 }), Object(external_wp_data_["withDispatch"])(dispatch => { 9444 return { 9445 onUpdateSticky(postSticky) { 9446 dispatch('core/editor').editPost({ 9447 sticky: postSticky 9448 }); 9449 } 9450 9451 }; 9452 })])(PostSticky)); 9453 9454 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js 9455 9456 9457 /** 9458 * External dependencies 9459 */ 9460 9461 /** 9462 * WordPress dependencies 9463 */ 9464 9465 9466 9467 9468 9469 9470 9471 9472 /** 9473 * Internal dependencies 9474 */ 9475 9476 9477 /** 9478 * Module Constants 9479 */ 9480 9481 const hierarchical_term_selector_DEFAULT_QUERY = { 9482 per_page: -1, 9483 orderby: 'name', 9484 order: 'asc', 9485 _fields: 'id,name,parent' 9486 }; 9487 const MIN_TERMS_COUNT_FOR_FILTER = 8; 9488 9489 class hierarchical_term_selector_HierarchicalTermSelector extends external_wp_element_["Component"] { 9490 constructor() { 9491 super(...arguments); 9492 this.findTerm = this.findTerm.bind(this); 9493 this.onChange = this.onChange.bind(this); 9494 this.onChangeFormName = this.onChangeFormName.bind(this); 9495 this.onChangeFormParent = this.onChangeFormParent.bind(this); 9496 this.onAddTerm = this.onAddTerm.bind(this); 9497 this.onToggleForm = this.onToggleForm.bind(this); 9498 this.setFilterValue = this.setFilterValue.bind(this); 9499 this.sortBySelected = this.sortBySelected.bind(this); 9500 this.state = { 9501 loading: true, 9502 availableTermsTree: [], 9503 availableTerms: [], 9504 adding: false, 9505 formName: '', 9506 formParent: '', 9507 showForm: false, 9508 filterValue: '', 9509 filteredTermsTree: [] 9510 }; 9511 } 9512 9513 onChange(termId) { 9514 const { 9515 onUpdateTerms, 9516 terms = [], 9517 taxonomy 9518 } = this.props; 9519 const hasTerm = terms.indexOf(termId) !== -1; 9520 const newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [...terms, termId]; 9521 onUpdateTerms(newTerms, taxonomy.rest_base); 9522 } 9523 9524 onChangeFormName(event) { 9525 const newValue = event.target.value.trim() === '' ? '' : event.target.value; 9526 this.setState({ 9527 formName: newValue 9528 }); 9529 } 9530 9531 onChangeFormParent(newParent) { 9532 this.setState({ 9533 formParent: newParent 9534 }); 9535 } 9536 9537 onToggleForm() { 9538 this.setState(state => ({ 9539 showForm: !state.showForm 9540 })); 9541 } 9542 9543 findTerm(terms, parent, name) { 9544 return Object(external_lodash_["find"])(terms, term => { 9545 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); 9546 }); 9547 } 9548 9549 onAddTerm(event) { 9550 event.preventDefault(); 9551 const { 9552 onUpdateTerms, 9553 taxonomy, 9554 terms, 9555 slug 9556 } = this.props; 9557 const { 9558 formName, 9559 formParent, 9560 adding, 9561 availableTerms 9562 } = this.state; 9563 9564 if (formName === '' || adding) { 9565 return; 9566 } // check if the term we are adding already exists 9567 9568 9569 const existingTerm = this.findTerm(availableTerms, formParent, formName); 9570 9571 if (existingTerm) { 9572 // if the term we are adding exists but is not selected select it 9573 if (!Object(external_lodash_["some"])(terms, term => term === existingTerm.id)) { 9574 onUpdateTerms([...terms, existingTerm.id], taxonomy.rest_base); 9575 } 9576 9577 this.setState({ 9578 formName: '', 9579 formParent: '' 9580 }); 9581 return; 9582 } 9583 9584 this.setState({ 9585 adding: true 9586 }); 9587 this.addRequest = external_wp_apiFetch_default()({ 9588 path: `/wp/v2/${taxonomy.rest_base}`, 9589 method: 'POST', 9590 data: { 9591 name: formName, 9592 parent: formParent ? formParent : undefined 9593 } 9594 }); // Tries to create a term or fetch it if it already exists 9595 9596 const findOrCreatePromise = this.addRequest.catch(error => { 9597 const errorCode = error.code; 9598 9599 if (errorCode === 'term_exists') { 9600 // search the new category created since last fetch 9601 this.addRequest = external_wp_apiFetch_default()({ 9602 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...hierarchical_term_selector_DEFAULT_QUERY, 9603 parent: formParent || 0, 9604 search: formName 9605 }) 9606 }); 9607 return this.addRequest.then(searchResult => { 9608 return this.findTerm(searchResult, formParent, formName); 9609 }); 9610 } 9611 9612 return Promise.reject(error); 9613 }); 9614 findOrCreatePromise.then(term => { 9615 const hasTerm = !!Object(external_lodash_["find"])(this.state.availableTerms, availableTerm => availableTerm.id === term.id); 9616 const newAvailableTerms = hasTerm ? this.state.availableTerms : [term, ...this.state.availableTerms]; 9617 const termAddedMessage = Object(external_wp_i18n_["sprintf"])( 9618 /* translators: %s: taxonomy name */ 9619 Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_wp_i18n_["__"])('Category') : Object(external_wp_i18n_["__"])('Term'))); 9620 this.props.speak(termAddedMessage, 'assertive'); 9621 this.addRequest = null; 9622 this.setState({ 9623 adding: false, 9624 formName: '', 9625 formParent: '', 9626 availableTerms: newAvailableTerms, 9627 availableTermsTree: this.sortBySelected(buildTermsTree(newAvailableTerms)) 9628 }); 9629 onUpdateTerms([...terms, term.id], taxonomy.rest_base); 9630 }, xhr => { 9631 if (xhr.statusText === 'abort') { 9632 return; 9633 } 9634 9635 this.addRequest = null; 9636 this.setState({ 9637 adding: false 9638 }); 9639 }); 9640 } 9641 9642 componentDidMount() { 9643 this.fetchTerms(); 9644 } 9645 9646 componentWillUnmount() { 9647 Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']); 9648 Object(external_lodash_["invoke"])(this.addRequest, ['abort']); 9649 } 9650 9651 componentDidUpdate(prevProps) { 9652 if (this.props.taxonomy !== prevProps.taxonomy) { 9653 this.fetchTerms(); 9654 } 9655 } 9656 9657 fetchTerms() { 9658 const { 9659 taxonomy 9660 } = this.props; 9661 9662 if (!taxonomy) { 9663 return; 9664 } 9665 9666 this.fetchRequest = external_wp_apiFetch_default()({ 9667 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, hierarchical_term_selector_DEFAULT_QUERY) 9668 }); 9669 this.fetchRequest.then(terms => { 9670 // resolve 9671 const availableTermsTree = this.sortBySelected(buildTermsTree(terms)); 9672 this.fetchRequest = null; 9673 this.setState({ 9674 loading: false, 9675 availableTermsTree, 9676 availableTerms: terms 9677 }); 9678 }, xhr => { 9679 // reject 9680 if (xhr.statusText === 'abort') { 9681 return; 9682 } 9683 9684 this.fetchRequest = null; 9685 this.setState({ 9686 loading: false 9687 }); 9688 }); 9689 } 9690 9691 sortBySelected(termsTree) { 9692 const { 9693 terms 9694 } = this.props; 9695 9696 const treeHasSelection = termTree => { 9697 if (terms.indexOf(termTree.id) !== -1) { 9698 return true; 9699 } 9700 9701 if (undefined === termTree.children) { 9702 return false; 9703 } 9704 9705 const anyChildIsSelected = termTree.children.map(treeHasSelection).filter(child => child).length > 0; 9706 9707 if (anyChildIsSelected) { 9708 return true; 9709 } 9710 9711 return false; 9712 }; 9713 9714 const termOrChildIsSelected = (termA, termB) => { 9715 const termASelected = treeHasSelection(termA); 9716 const termBSelected = treeHasSelection(termB); 9717 9718 if (termASelected === termBSelected) { 9719 return 0; 9720 } 9721 9722 if (termASelected && !termBSelected) { 9723 return -1; 9724 } 9725 9726 if (!termASelected && termBSelected) { 9727 return 1; 9728 } 9729 9730 return 0; 9731 }; 9732 9733 termsTree.sort(termOrChildIsSelected); 9734 return termsTree; 9735 } 9736 9737 setFilterValue(event) { 9738 const { 9739 availableTermsTree 9740 } = this.state; 9741 const filterValue = event.target.value; 9742 const filteredTermsTree = availableTermsTree.map(this.getFilterMatcher(filterValue)).filter(term => term); 9743 9744 const getResultCount = terms => { 9745 let count = 0; 9746 9747 for (let i = 0; i < terms.length; i++) { 9748 count++; 9749 9750 if (undefined !== terms[i].children) { 9751 count += getResultCount(terms[i].children); 9752 } 9753 } 9754 9755 return count; 9756 }; 9757 9758 this.setState({ 9759 filterValue, 9760 filteredTermsTree 9761 }); 9762 const resultCount = getResultCount(filteredTermsTree); 9763 const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])( 9764 /* translators: %d: number of results */ 9765 Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); 9766 this.props.debouncedSpeak(resultsFoundMessage, 'assertive'); 9767 } 9768 9769 getFilterMatcher(filterValue) { 9770 const matchTermsForFilter = originalTerm => { 9771 if ('' === filterValue) { 9772 return originalTerm; 9773 } // Shallow clone, because we'll be filtering the term's children and 9774 // don't want to modify the original term. 9775 9776 9777 const term = { ...originalTerm 9778 }; // Map and filter the children, recursive so we deal with grandchildren 9779 // and any deeper levels. 9780 9781 if (term.children.length > 0) { 9782 term.children = term.children.map(matchTermsForFilter).filter(child => child); 9783 } // If the term's name contains the filterValue, or it has children 9784 // (i.e. some child matched at some point in the tree) then return it. 9785 9786 9787 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { 9788 return term; 9789 } // Otherwise, return false. After mapping, the list of terms will need 9790 // to have false values filtered out. 9791 9792 9793 return false; 9794 }; 9795 9796 return matchTermsForFilter; 9797 } 9798 9799 renderTerms(renderedTerms) { 9800 const { 9801 terms = [] 9802 } = this.props; 9803 return renderedTerms.map(term => { 9804 return Object(external_wp_element_["createElement"])("div", { 9805 key: term.id, 9806 className: "editor-post-taxonomies__hierarchical-terms-choice" 9807 }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { 9808 checked: terms.indexOf(term.id) !== -1, 9809 onChange: () => { 9810 const termId = parseInt(term.id, 10); 9811 this.onChange(termId); 9812 }, 9813 label: Object(external_lodash_["unescape"])(term.name) 9814 }), !!term.children.length && Object(external_wp_element_["createElement"])("div", { 9815 className: "editor-post-taxonomies__hierarchical-terms-subchoices" 9816 }, this.renderTerms(term.children))); 9817 }); 9818 } 9819 9820 render() { 9821 const { 9822 slug, 9823 taxonomy, 9824 instanceId, 9825 hasCreateAction, 9826 hasAssignAction 9827 } = this.props; 9828 9829 if (!hasAssignAction) { 9830 return null; 9831 } 9832 9833 const { 9834 availableTermsTree, 9835 availableTerms, 9836 filteredTermsTree, 9837 formName, 9838 formParent, 9839 loading, 9840 showForm, 9841 filterValue 9842 } = this.state; 9843 9844 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); 9845 9846 const newTermButtonLabel = labelWithFallback('add_new_item', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term')); 9847 const newTermLabel = labelWithFallback('new_item_name', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term')); 9848 const parentSelectLabel = labelWithFallback('parent_item', Object(external_wp_i18n_["__"])('Parent Category'), Object(external_wp_i18n_["__"])('Parent Term')); 9849 const noParentOption = `— ${parentSelectLabel} —`; 9850 const newTermSubmitLabel = newTermButtonLabel; 9851 const inputId = `editor-post-taxonomies__hierarchical-terms-input-${instanceId}`; 9852 const filterInputId = `editor-post-taxonomies__hierarchical-terms-filter-${instanceId}`; 9853 const filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_wp_i18n_["__"])('Search Terms')); 9854 const groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_wp_i18n_["__"])('Terms')); 9855 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; 9856 return [showFilter && Object(external_wp_element_["createElement"])("label", { 9857 key: "filter-label", 9858 htmlFor: filterInputId 9859 }, filterLabel), showFilter && Object(external_wp_element_["createElement"])("input", { 9860 type: "search", 9861 id: filterInputId, 9862 value: filterValue, 9863 onChange: this.setFilterValue, 9864 className: "editor-post-taxonomies__hierarchical-terms-filter", 9865 key: "term-filter-input" 9866 }), Object(external_wp_element_["createElement"])("div", { 9867 className: "editor-post-taxonomies__hierarchical-terms-list", 9868 key: "term-list", 9869 tabIndex: "0", 9870 role: "group", 9871 "aria-label": groupLabel 9872 }, this.renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 9873 key: "term-add-button", 9874 onClick: this.onToggleForm, 9875 className: "editor-post-taxonomies__hierarchical-terms-add", 9876 "aria-expanded": showForm, 9877 isLink: true 9878 }, newTermButtonLabel), showForm && Object(external_wp_element_["createElement"])("form", { 9879 onSubmit: this.onAddTerm, 9880 key: "hierarchical-terms-form" 9881 }, Object(external_wp_element_["createElement"])("label", { 9882 htmlFor: inputId, 9883 className: "editor-post-taxonomies__hierarchical-terms-label" 9884 }, newTermLabel), Object(external_wp_element_["createElement"])("input", { 9885 type: "text", 9886 id: inputId, 9887 className: "editor-post-taxonomies__hierarchical-terms-input", 9888 value: formName, 9889 onChange: this.onChangeFormName, 9890 required: true 9891 }), !!availableTerms.length && Object(external_wp_element_["createElement"])(external_wp_components_["TreeSelect"], { 9892 label: parentSelectLabel, 9893 noOptionLabel: noParentOption, 9894 onChange: this.onChangeFormParent, 9895 selectedId: formParent, 9896 tree: availableTermsTree 9897 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 9898 isSecondary: true, 9899 type: "submit", 9900 className: "editor-post-taxonomies__hierarchical-terms-submit" 9901 }, newTermSubmitLabel))]; 9902 } 9903 9904 } 9905 9906 /* harmony default export */ var hierarchical_term_selector = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { 9907 slug 9908 }) => { 9909 const { 9910 getCurrentPost 9911 } = select('core/editor'); 9912 const { 9913 getTaxonomy 9914 } = select('core'); 9915 const taxonomy = getTaxonomy(slug); 9916 return { 9917 hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, 9918 hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, 9919 terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], 9920 taxonomy 9921 }; 9922 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 9923 onUpdateTerms(terms, restBase) { 9924 dispatch('core/editor').editPost({ 9925 [restBase]: terms 9926 }); 9927 } 9928 9929 })), external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType')])(hierarchical_term_selector_HierarchicalTermSelector)); 9930 9931 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js 9932 9933 9934 /** 9935 * External dependencies 9936 */ 9937 9938 /** 9939 * WordPress dependencies 9940 */ 9941 9942 9943 9944 9945 /** 9946 * Internal dependencies 9947 */ 9948 9949 9950 9951 function PostTaxonomies({ 9952 postType, 9953 taxonomies, 9954 taxonomyWrapper = external_lodash_["identity"] 9955 }) { 9956 const availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType)); 9957 const visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui); 9958 return visibleTaxonomies.map(taxonomy => { 9959 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; 9960 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { 9961 key: `taxonomy-${taxonomy.slug}` 9962 }, taxonomyWrapper(Object(external_wp_element_["createElement"])(TaxonomyComponent, { 9963 slug: taxonomy.slug 9964 }), taxonomy)); 9965 }); 9966 } 9967 /* harmony default export */ var post_taxonomies = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 9968 return { 9969 postType: select('core/editor').getCurrentPostType(), 9970 taxonomies: select('core').getTaxonomies({ 9971 per_page: -1 9972 }) 9973 }; 9974 })])(PostTaxonomies)); 9975 9976 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js 9977 /** 9978 * External dependencies 9979 */ 9980 9981 /** 9982 * WordPress dependencies 9983 */ 9984 9985 9986 9987 function PostTaxonomiesCheck({ 9988 postType, 9989 taxonomies, 9990 children 9991 }) { 9992 const hasTaxonomies = Object(external_lodash_["some"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType)); 9993 9994 if (!hasTaxonomies) { 9995 return null; 9996 } 9997 9998 return children; 9999 } 10000 /* harmony default export */ var post_taxonomies_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 10001 return { 10002 postType: select('core/editor').getCurrentPostType(), 10003 taxonomies: select('core').getTaxonomies({ 10004 per_page: -1 10005 }) 10006 }; 10007 })])(PostTaxonomiesCheck)); 10008 10009 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 10010 var lib = __webpack_require__("O6Fj"); 10011 var lib_default = /*#__PURE__*/__webpack_require__.n(lib); 10012 10013 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js 10014 10015 10016 /** 10017 * External dependencies 10018 */ 10019 10020 /** 10021 * WordPress dependencies 10022 */ 10023 10024 10025 10026 10027 10028 10029 10030 function PostTextEditor() { 10031 const postContent = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostContent(), []); 10032 const { 10033 editPost, 10034 resetEditorBlocks 10035 } = Object(external_wp_data_["useDispatch"])('core/editor'); 10036 const [value, setValue] = Object(external_wp_element_["useState"])(postContent); 10037 const [isDirty, setIsDirty] = Object(external_wp_element_["useState"])(false); 10038 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTextEditor); 10039 10040 if (!isDirty && value !== postContent) { 10041 setValue(postContent); 10042 } 10043 /** 10044 * Handles a textarea change event to notify the onChange prop callback and 10045 * reflect the new value in the component's own state. This marks the start 10046 * of the user's edits, if not already changed, preventing future props 10047 * changes to value from replacing the rendered value. This is expected to 10048 * be followed by a reset to dirty state via `stopEditing`. 10049 * 10050 * @see stopEditing 10051 * 10052 * @param {Event} event Change event. 10053 */ 10054 10055 10056 const onChange = event => { 10057 const newValue = event.target.value; 10058 editPost({ 10059 content: newValue 10060 }); 10061 setValue(newValue); 10062 setIsDirty(true); 10063 }; 10064 /** 10065 * Function called when the user has completed their edits, responsible for 10066 * ensuring that changes, if made, are surfaced to the onPersist prop 10067 * callback and resetting dirty state. 10068 */ 10069 10070 10071 const stopEditing = () => { 10072 if (isDirty) { 10073 const blocks = Object(external_wp_blocks_["parse"])(value); 10074 resetEditorBlocks(blocks); 10075 setIsDirty(false); 10076 } 10077 }; 10078 10079 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 10080 as: "label", 10081 htmlFor: `post-content-${instanceId}` 10082 }, Object(external_wp_i18n_["__"])('Type text or HTML')), Object(external_wp_element_["createElement"])(lib_default.a, { 10083 autoComplete: "off", 10084 dir: "auto", 10085 value: value, 10086 onChange: onChange, 10087 onBlur: stopEditing, 10088 className: "editor-post-text-editor", 10089 id: `post-content-${instanceId}`, 10090 placeholder: Object(external_wp_i18n_["__"])('Start writing with text or HTML') 10091 })); 10092 } 10093 10094 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js 10095 10096 10097 /** 10098 * External dependencies 10099 */ 10100 10101 10102 /** 10103 * WordPress dependencies 10104 */ 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 /** 10116 * Internal dependencies 10117 */ 10118 10119 10120 /** 10121 * Constants 10122 */ 10123 10124 const REGEXP_NEWLINES = /[\r\n]+/g; 10125 function PostTitle() { 10126 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTitle); 10127 const ref = Object(external_wp_element_["useRef"])(); 10128 const [isSelected, setIsSelected] = Object(external_wp_element_["useState"])(false); 10129 const { 10130 editPost 10131 } = Object(external_wp_data_["useDispatch"])('core/editor'); 10132 const { 10133 insertDefaultBlock, 10134 clearSelectedBlock, 10135 insertBlocks 10136 } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); 10137 const { 10138 isCleanNewPost, 10139 title, 10140 placeholder, 10141 isFocusMode, 10142 hasFixedToolbar 10143 } = Object(external_wp_data_["useSelect"])(select => { 10144 const { 10145 getEditedPostAttribute, 10146 isCleanNewPost: _isCleanNewPost 10147 } = select('core/editor'); 10148 const { 10149 getSettings 10150 } = select(external_wp_blockEditor_["store"]); 10151 const { 10152 titlePlaceholder, 10153 focusMode, 10154 hasFixedToolbar: _hasFixedToolbar 10155 } = getSettings(); 10156 return { 10157 isCleanNewPost: _isCleanNewPost(), 10158 title: getEditedPostAttribute('title'), 10159 placeholder: titlePlaceholder, 10160 isFocusMode: focusMode, 10161 hasFixedToolbar: _hasFixedToolbar 10162 }; 10163 }); 10164 Object(external_wp_element_["useEffect"])(() => { 10165 if (!ref.current) { 10166 return; 10167 } 10168 10169 const { 10170 ownerDocument 10171 } = ref.current; 10172 const { 10173 activeElement, 10174 body 10175 } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should 10176 // only happen for a new post, which means we focus the title on new 10177 // post so the author can start typing right away, without needing to 10178 // click anything. 10179 10180 if (isCleanNewPost && (!activeElement || body === activeElement)) { 10181 ref.current.focus(); 10182 } 10183 }, [isCleanNewPost]); 10184 10185 function onEnterPress() { 10186 insertDefaultBlock(undefined, undefined, 0); 10187 } 10188 10189 function onInsertBlockAfter(blocks) { 10190 insertBlocks(blocks, 0); 10191 } 10192 10193 function onUpdate(newTitle) { 10194 editPost({ 10195 title: newTitle 10196 }); 10197 } 10198 10199 function onSelect() { 10200 setIsSelected(true); 10201 clearSelectedBlock(); 10202 } 10203 10204 function onUnselect() { 10205 setIsSelected(false); 10206 } 10207 10208 function onChange(event) { 10209 onUpdate(event.target.value.replace(REGEXP_NEWLINES, ' ')); 10210 } 10211 10212 function onKeyDown(event) { 10213 if (event.keyCode === external_wp_keycodes_["ENTER"]) { 10214 event.preventDefault(); 10215 onEnterPress(); 10216 } 10217 } 10218 10219 function onPaste(event) { 10220 const clipboardData = event.clipboardData; 10221 let plainText = ''; 10222 let html = ''; // IE11 only supports `Text` as an argument for `getData` and will 10223 // otherwise throw an invalid argument error, so we try the standard 10224 // arguments first, then fallback to `Text` if they fail. 10225 10226 try { 10227 plainText = clipboardData.getData('text/plain'); 10228 html = clipboardData.getData('text/html'); 10229 } catch (error1) { 10230 try { 10231 html = clipboardData.getData('Text'); 10232 } catch (error2) { 10233 // Some browsers like UC Browser paste plain text by default and 10234 // don't support clipboardData at all, so allow default 10235 // behaviour. 10236 return; 10237 } 10238 } // Allows us to ask for this information when we get a report. 10239 10240 10241 window.console.log('Received HTML:\n\n', html); 10242 window.console.log('Received plain text:\n\n', plainText); 10243 const content = Object(external_wp_blocks_["pasteHandler"])({ 10244 HTML: html, 10245 plainText 10246 }); 10247 10248 if (typeof content !== 'string' && content.length) { 10249 event.preventDefault(); 10250 const [firstBlock] = content; 10251 10252 if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { 10253 onUpdate(firstBlock.attributes.content); 10254 onInsertBlockAfter(content.slice(1)); 10255 } else { 10256 onInsertBlockAfter(content); 10257 } 10258 } 10259 } // The wp-block className is important for editor styles. 10260 // This same block is used in both the visual and the code editor. 10261 10262 10263 const className = classnames_default()('wp-block editor-post-title editor-post-title__block', { 10264 'is-selected': isSelected, 10265 'is-focus-mode': isFocusMode, 10266 'has-fixed-toolbar': hasFixedToolbar 10267 }); 10268 const decodedPlaceholder = Object(external_wp_htmlEntities_["decodeEntities"])(placeholder); 10269 return Object(external_wp_element_["createElement"])(post_type_support_check, { 10270 supportKeys: "title" 10271 }, Object(external_wp_element_["createElement"])("div", { 10272 className: className 10273 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 10274 as: "label", 10275 htmlFor: `post-title-${instanceId}` 10276 }, decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title')), Object(external_wp_element_["createElement"])(lib_default.a, { 10277 ref: ref, 10278 id: `post-title-${instanceId}`, 10279 className: "editor-post-title__input", 10280 value: title, 10281 onChange: onChange, 10282 placeholder: decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title'), 10283 onFocus: onSelect, 10284 onBlur: onUnselect, 10285 onKeyDown: onKeyDown, 10286 onKeyPress: onUnselect, 10287 onPaste: onPaste 10288 }))); 10289 } 10290 10291 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js 10292 10293 10294 /** 10295 * WordPress dependencies 10296 */ 10297 10298 10299 10300 10301 10302 function PostTrash({ 10303 isNew, 10304 postId, 10305 postType, 10306 ...props 10307 }) { 10308 if (isNew || !postId) { 10309 return null; 10310 } 10311 10312 const onClick = () => props.trashPost(postId, postType); 10313 10314 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 10315 className: "editor-post-trash", 10316 isDestructive: true, 10317 isTertiary: true, 10318 onClick: onClick 10319 }, Object(external_wp_i18n_["__"])('Move to trash')); 10320 } 10321 10322 /* harmony default export */ var post_trash = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 10323 const { 10324 isEditedPostNew, 10325 getCurrentPostId, 10326 getCurrentPostType 10327 } = select('core/editor'); 10328 return { 10329 isNew: isEditedPostNew(), 10330 postId: getCurrentPostId(), 10331 postType: getCurrentPostType() 10332 }; 10333 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ 10334 trashPost: dispatch('core/editor').trashPost 10335 }))])(PostTrash)); 10336 10337 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js 10338 /** 10339 * WordPress dependencies 10340 */ 10341 10342 10343 function PostTrashCheck({ 10344 isNew, 10345 postId, 10346 canUserDelete, 10347 children 10348 }) { 10349 if (isNew || !postId || !canUserDelete) { 10350 return null; 10351 } 10352 10353 return children; 10354 } 10355 10356 /* harmony default export */ var post_trash_check = (Object(external_wp_data_["withSelect"])(select => { 10357 const { 10358 isEditedPostNew, 10359 getCurrentPostId, 10360 getCurrentPostType 10361 } = select('core/editor'); 10362 const { 10363 getPostType, 10364 canUser 10365 } = select('core'); 10366 const postId = getCurrentPostId(); 10367 const postType = getPostType(getCurrentPostType()); 10368 const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase 10369 10370 return { 10371 isNew: isEditedPostNew(), 10372 postId, 10373 canUserDelete: postId && resource ? canUser('delete', resource, postId) : false 10374 }; 10375 })(PostTrashCheck)); 10376 10377 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js 10378 /** 10379 * External dependencies 10380 */ 10381 10382 /** 10383 * WordPress dependencies 10384 */ 10385 10386 10387 10388 function PostVisibilityCheck({ 10389 hasPublishAction, 10390 render 10391 }) { 10392 const canEdit = hasPublishAction; 10393 return render({ 10394 canEdit 10395 }); 10396 } 10397 /* harmony default export */ var post_visibility_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { 10398 const { 10399 getCurrentPost, 10400 getCurrentPostType 10401 } = select('core/editor'); 10402 return { 10403 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), 10404 postType: getCurrentPostType() 10405 }; 10406 })])(PostVisibilityCheck)); 10407 10408 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js 10409 10410 10411 /** 10412 * WordPress dependencies 10413 */ 10414 10415 const info_info = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 10416 xmlns: "http://www.w3.org/2000/svg", 10417 viewBox: "0 0 24 24" 10418 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 10419 d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" 10420 })); 10421 /* harmony default export */ var library_info = (info_info); 10422 10423 // EXTERNAL MODULE: external ["wp","wordcount"] 10424 var external_wp_wordcount_ = __webpack_require__("7fqt"); 10425 10426 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js 10427 10428 10429 /** 10430 * WordPress dependencies 10431 */ 10432 10433 10434 10435 function WordCount() { 10436 const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content')); 10437 /* 10438 * translators: If your word count is based on single characters (e.g. East Asian characters), 10439 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 10440 * Do not translate into your own language. 10441 */ 10442 10443 const wordCountType = Object(external_wp_i18n_["_x"])('words', 'Word count type. Do not translate!'); 10444 10445 return Object(external_wp_element_["createElement"])("span", { 10446 className: "word-count" 10447 }, Object(external_wp_wordcount_["count"])(content, wordCountType)); 10448 } 10449 10450 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js 10451 /** 10452 * WordPress dependencies 10453 */ 10454 10455 10456 function CharacterCount() { 10457 const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content')); 10458 return Object(external_wp_wordcount_["count"])(content, 'characters_including_spaces'); 10459 } 10460 10461 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js 10462 10463 10464 /** 10465 * WordPress dependencies 10466 */ 10467 10468 10469 10470 /** 10471 * Internal dependencies 10472 */ 10473 10474 10475 10476 10477 10478 function TableOfContentsPanel({ 10479 hasOutlineItemsDisabled, 10480 onRequestClose 10481 }) { 10482 const { 10483 headingCount, 10484 paragraphCount, 10485 numberOfBlocks 10486 } = Object(external_wp_data_["useSelect"])(select => { 10487 const { 10488 getGlobalBlockCount 10489 } = select(external_wp_blockEditor_["store"]); 10490 return { 10491 headingCount: getGlobalBlockCount('core/heading'), 10492 paragraphCount: getGlobalBlockCount('core/paragraph'), 10493 numberOfBlocks: getGlobalBlockCount() 10494 }; 10495 }, []); 10496 return ( 10497 /* 10498 * Disable reason: The `list` ARIA role is redundant but 10499 * Safari+VoiceOver won't announce the list otherwise. 10500 */ 10501 10502 /* eslint-disable jsx-a11y/no-redundant-roles */ 10503 Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 10504 className: "table-of-contents__wrapper", 10505 role: "note", 10506 "aria-label": Object(external_wp_i18n_["__"])('Document Statistics'), 10507 tabIndex: "0" 10508 }, Object(external_wp_element_["createElement"])("ul", { 10509 role: "list", 10510 className: "table-of-contents__counts" 10511 }, Object(external_wp_element_["createElement"])("li", { 10512 className: "table-of-contents__count" 10513 }, Object(external_wp_i18n_["__"])('Characters'), Object(external_wp_element_["createElement"])("span", { 10514 className: "table-of-contents__number" 10515 }, Object(external_wp_element_["createElement"])(CharacterCount, null))), Object(external_wp_element_["createElement"])("li", { 10516 className: "table-of-contents__count" 10517 }, Object(external_wp_i18n_["__"])('Words'), Object(external_wp_element_["createElement"])(WordCount, null)), Object(external_wp_element_["createElement"])("li", { 10518 className: "table-of-contents__count" 10519 }, Object(external_wp_i18n_["__"])('Headings'), Object(external_wp_element_["createElement"])("span", { 10520 className: "table-of-contents__number" 10521 }, headingCount)), Object(external_wp_element_["createElement"])("li", { 10522 className: "table-of-contents__count" 10523 }, Object(external_wp_i18n_["__"])('Paragraphs'), Object(external_wp_element_["createElement"])("span", { 10524 className: "table-of-contents__number" 10525 }, paragraphCount)), Object(external_wp_element_["createElement"])("li", { 10526 className: "table-of-contents__count" 10527 }, Object(external_wp_i18n_["__"])('Blocks'), Object(external_wp_element_["createElement"])("span", { 10528 className: "table-of-contents__number" 10529 }, numberOfBlocks)))), headingCount > 0 && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("hr", null), Object(external_wp_element_["createElement"])("h2", { 10530 className: "table-of-contents__title" 10531 }, Object(external_wp_i18n_["__"])('Document Outline')), Object(external_wp_element_["createElement"])(document_outline, { 10532 onSelect: onRequestClose, 10533 hasOutlineItemsDisabled: hasOutlineItemsDisabled 10534 }))) 10535 /* eslint-enable jsx-a11y/no-redundant-roles */ 10536 10537 ); 10538 } 10539 10540 /* harmony default export */ var panel = (TableOfContentsPanel); 10541 10542 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js 10543 10544 10545 10546 /** 10547 * WordPress dependencies 10548 */ 10549 10550 10551 10552 10553 10554 10555 /** 10556 * Internal dependencies 10557 */ 10558 10559 10560 10561 function TableOfContents({ 10562 hasOutlineItemsDisabled, 10563 repositionDropdown, 10564 ...props 10565 }, ref) { 10566 const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(external_wp_blockEditor_["store"]).getBlockCount(), []); 10567 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 10568 position: repositionDropdown ? 'middle right right' : 'bottom', 10569 className: "table-of-contents", 10570 contentClassName: "table-of-contents__popover", 10571 renderToggle: ({ 10572 isOpen, 10573 onToggle 10574 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { 10575 ref: ref, 10576 onClick: hasBlocks ? onToggle : undefined, 10577 icon: library_info, 10578 "aria-expanded": isOpen, 10579 "aria-haspopup": "true" 10580 /* translators: button label text should, if possible, be under 16 characters. */ 10581 , 10582 label: Object(external_wp_i18n_["__"])('Details'), 10583 tooltipPosition: "bottom", 10584 "aria-disabled": !hasBlocks 10585 })), 10586 renderContent: ({ 10587 onClose 10588 }) => Object(external_wp_element_["createElement"])(panel, { 10589 onRequestClose: onClose, 10590 hasOutlineItemsDisabled: hasOutlineItemsDisabled 10591 }) 10592 }); 10593 } 10594 10595 /* harmony default export */ var table_of_contents = (Object(external_wp_element_["forwardRef"])(TableOfContents)); 10596 10597 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js 10598 /** 10599 * WordPress dependencies 10600 */ 10601 10602 10603 10604 /** 10605 * Warns the user if there are unsaved changes before leaving the editor. 10606 * Compatible with Post Editor and Site Editor. 10607 * 10608 * @return {WPComponent} The component. 10609 */ 10610 10611 function UnsavedChangesWarning() { 10612 const isDirty = Object(external_wp_data_["useSelect"])(select => { 10613 return () => { 10614 const { 10615 __experimentalGetDirtyEntityRecords 10616 } = select('core'); 10617 10618 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 10619 10620 return dirtyEntityRecords.length > 0; 10621 }; 10622 }, []); 10623 /** 10624 * Warns the user if there are unsaved changes before leaving the editor. 10625 * 10626 * @param {Event} event `beforeunload` event. 10627 * 10628 * @return {?string} Warning prompt message, if unsaved changes exist. 10629 */ 10630 10631 const warnIfUnsavedChanges = event => { 10632 // We need to call the selector directly in the listener to avoid race 10633 // conditions with `BrowserURL` where `componentDidUpdate` gets the 10634 // new value of `isEditedPostDirty` before this component does, 10635 // causing this component to incorrectly think a trashed post is still dirty. 10636 if (isDirty()) { 10637 event.returnValue = Object(external_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); 10638 return event.returnValue; 10639 } 10640 }; 10641 10642 Object(external_wp_element_["useEffect"])(() => { 10643 window.addEventListener('beforeunload', warnIfUnsavedChanges); 10644 return () => { 10645 window.removeEventListener('beforeunload', warnIfUnsavedChanges); 10646 }; 10647 }, []); 10648 return null; 10649 } 10650 10651 // EXTERNAL MODULE: external ["wp","reusableBlocks"] 10652 var external_wp_reusableBlocks_ = __webpack_require__("diJD"); 10653 10654 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js 10655 10656 10657 /** 10658 * WordPress dependencies 10659 */ 10660 10661 10662 10663 10664 /** 10665 * Internal dependencies 10666 */ 10667 10668 10669 const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => Object(external_wp_data_["withRegistry"])(props => { 10670 const { 10671 useSubRegistry = true, 10672 registry, 10673 ...additionalProps 10674 } = props; 10675 10676 if (!useSubRegistry) { 10677 return Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps); 10678 } 10679 10680 const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null); 10681 Object(external_wp_element_["useEffect"])(() => { 10682 const newRegistry = Object(external_wp_data_["createRegistry"])({ 10683 'core/block-editor': external_wp_blockEditor_["storeConfig"] 10684 }, registry); 10685 newRegistry.registerStore('core/editor', storeConfig); 10686 setSubRegistry(newRegistry); 10687 }, [registry]); 10688 10689 if (!subRegistry) { 10690 return null; 10691 } 10692 10693 return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], { 10694 value: subRegistry 10695 }, Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps)); 10696 }), 'withRegistryProvider'); 10697 /* harmony default export */ var with_registry_provider = (withRegistryProvider); 10698 10699 // EXTERNAL MODULE: external ["wp","mediaUtils"] 10700 var external_wp_mediaUtils_ = __webpack_require__("6aBm"); 10701 10702 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js 10703 /** 10704 * External dependencies 10705 */ 10706 10707 /** 10708 * WordPress dependencies 10709 */ 10710 10711 10712 10713 /** 10714 * Upload a media file when the file upload button is activated. 10715 * Wrapper around mediaUpload() that injects the current post ID. 10716 * 10717 * @param {Object} $0 Parameters object passed to the function. 10718 * @param {?Object} $0.additionalData Additional data to include in the request. 10719 * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. 10720 * @param {Array} $0.filesList List of files. 10721 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. 10722 * @param {Function} $0.onError Function called when an error happens. 10723 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. 10724 */ 10725 10726 function mediaUpload({ 10727 additionalData = {}, 10728 allowedTypes, 10729 filesList, 10730 maxUploadFileSize, 10731 onError = external_lodash_["noop"], 10732 onFileChange 10733 }) { 10734 const { 10735 getCurrentPostId, 10736 getEditorSettings 10737 } = Object(external_wp_data_["select"])('core/editor'); 10738 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; 10739 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; 10740 Object(external_wp_mediaUtils_["uploadMedia"])({ 10741 allowedTypes, 10742 filesList, 10743 onFileChange, 10744 additionalData: { 10745 post: getCurrentPostId(), 10746 ...additionalData 10747 }, 10748 maxUploadFileSize, 10749 onError: ({ 10750 message 10751 }) => onError(message), 10752 wpAllowedMimeTypes 10753 }); 10754 } 10755 10756 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js 10757 /** 10758 * External dependencies 10759 */ 10760 10761 /** 10762 * WordPress dependencies 10763 */ 10764 10765 10766 10767 10768 /** 10769 * Internal dependencies 10770 */ 10771 10772 10773 10774 /** 10775 * React hook used to compute the block editor settings to use for the post editor. 10776 * 10777 * @param {Object} settings EditorProvider settings prop. 10778 * @param {boolean} hasTemplate Whether template mode is enabled. 10779 * 10780 * @return {Object} Block Editor Settings. 10781 */ 10782 10783 function useBlockEditorSettings(settings, hasTemplate) { 10784 const { 10785 reusableBlocks, 10786 hasUploadPermissions, 10787 canUseUnfilteredHTML, 10788 isTitleSelected 10789 } = Object(external_wp_data_["useSelect"])(select => { 10790 const { 10791 canUserUseUnfilteredHTML, 10792 isPostTitleSelected 10793 } = select(store); 10794 const { 10795 canUser 10796 } = select(external_wp_coreData_["store"]); 10797 return { 10798 canUseUnfilteredHTML: canUserUseUnfilteredHTML(), 10799 reusableBlocks: select(external_wp_coreData_["store"]).getEntityRecords('postType', 'wp_block', 10800 /** 10801 * Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle. 10802 * Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661 10803 */ 10804 { 10805 per_page: external_wp_element_["Platform"].select({ 10806 web: -1, 10807 native: 100 10808 }) 10809 }), 10810 hasUploadPermissions: Object(external_lodash_["defaultTo"])(canUser('create', 'media'), true), 10811 // This selector is only defined on mobile. 10812 isTitleSelected: isPostTitleSelected && isPostTitleSelected() 10813 }; 10814 }, []); 10815 const { 10816 undo 10817 } = Object(external_wp_data_["useDispatch"])(store); 10818 return Object(external_wp_element_["useMemo"])(() => ({ ...Object(external_lodash_["pick"])(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalGlobalStylesUserEntityId', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock']), 10819 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, 10820 __experimentalReusableBlocks: reusableBlocks, 10821 __experimentalFetchLinkSuggestions: (search, searchOptions) => Object(external_wp_coreData_["__experimentalFetchLinkSuggestions"])(search, searchOptions, settings), 10822 __experimentalFetchRemoteUrlData: url => Object(external_wp_coreData_["__experimentalFetchRemoteUrlData"])(url), 10823 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, 10824 __experimentalUndo: undo, 10825 __experimentalShouldInsertAtTheTop: isTitleSelected, 10826 outlineMode: hasTemplate 10827 }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, isTitleSelected, hasTemplate]); 10828 } 10829 10830 /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings); 10831 10832 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js 10833 10834 10835 /** 10836 * WordPress dependencies 10837 */ 10838 10839 10840 10841 10842 10843 10844 10845 /** 10846 * Internal dependencies 10847 */ 10848 10849 10850 10851 10852 10853 function EditorProvider({ 10854 __unstableTemplate, 10855 post, 10856 settings, 10857 recovery, 10858 initialEdits, 10859 children 10860 }) { 10861 const defaultBlockContext = Object(external_wp_element_["useMemo"])(() => { 10862 if (post.type === 'wp_template') { 10863 return {}; 10864 } 10865 10866 return { 10867 postId: post.id, 10868 postType: post.type 10869 }; 10870 }, [post.id, post.type]); 10871 const { 10872 selection, 10873 isReady 10874 } = Object(external_wp_data_["useSelect"])(select => { 10875 const { 10876 getEditorSelection, 10877 __unstableIsEditorReady 10878 } = select(store); 10879 return { 10880 isReady: __unstableIsEditorReady(), 10881 selection: getEditorSelection() 10882 }; 10883 }, []); 10884 const { 10885 id, 10886 type 10887 } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post; 10888 const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('postType', type, { 10889 id 10890 }); 10891 const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate); 10892 const { 10893 updatePostLock, 10894 setupEditor, 10895 updateEditorSettings, 10896 __experimentalTearDownEditor 10897 } = Object(external_wp_data_["useDispatch"])(store); 10898 const { 10899 createWarningNotice 10900 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); // Iniitialize and tear down the editor. 10901 // Ideally this should be synced on each change and not just something you do once. 10902 10903 Object(external_wp_element_["useLayoutEffect"])(() => { 10904 // Assume that we don't need to initialize in the case of an error recovery. 10905 if (recovery) { 10906 return; 10907 } 10908 10909 updatePostLock(settings.postLock); 10910 setupEditor(post, initialEdits, settings.template); 10911 10912 if (settings.autosave) { 10913 createWarningNotice(Object(external_wp_i18n_["__"])('There is an autosave of this post that is more recent than the version below.'), { 10914 id: 'autosave-exists', 10915 actions: [{ 10916 label: Object(external_wp_i18n_["__"])('View the autosave'), 10917 url: settings.autosave.editLink 10918 }] 10919 }); 10920 } 10921 10922 return () => { 10923 __experimentalTearDownEditor(); 10924 }; 10925 }, []); // Synchronize the editor settings as they change 10926 10927 Object(external_wp_element_["useEffect"])(() => { 10928 updateEditorSettings(settings); 10929 }, [settings]); 10930 10931 if (!isReady) { 10932 return null; 10933 } 10934 10935 return Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], { 10936 kind: "root", 10937 type: "site" 10938 }, Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], { 10939 kind: "postType", 10940 type: post.type, 10941 id: post.id 10942 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockContextProvider"], { 10943 value: defaultBlockContext 10944 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorProvider"], { 10945 value: blocks, 10946 onChange: onChange, 10947 onInput: onInput, 10948 selection: selection, 10949 settings: editorSettings, 10950 useSubRegistry: false 10951 }, children, Object(external_wp_element_["createElement"])(external_wp_reusableBlocks_["ReusableBlocksMenuItems"], null))))); 10952 } 10953 10954 /* harmony default export */ var provider = (with_registry_provider(EditorProvider)); 10955 10956 // EXTERNAL MODULE: external ["wp","serverSideRender"] 10957 var external_wp_serverSideRender_ = __webpack_require__("JREk"); 10958 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_); 10959 10960 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js 10961 10962 10963 // Block Creation Components 10964 10965 /** 10966 * WordPress dependencies 10967 */ 10968 10969 10970 10971 10972 10973 function deprecateComponent(name, Wrapped, staticsToHoist = []) { 10974 const Component = Object(external_wp_element_["forwardRef"])((props, ref) => { 10975 external_wp_deprecated_default()('wp.editor.' + name, { 10976 since: '5.3', 10977 alternative: 'wp.blockEditor.' + name 10978 }); 10979 return Object(external_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({ 10980 ref: ref 10981 }, props)); 10982 }); 10983 staticsToHoist.forEach(staticName => { 10984 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); 10985 }); 10986 return Component; 10987 } 10988 10989 function deprecateFunction(name, func) { 10990 return (...args) => { 10991 external_wp_deprecated_default()('wp.editor.' + name, { 10992 since: '5.3', 10993 alternative: 'wp.blockEditor.' + name 10994 }); 10995 return func(...args); 10996 }; 10997 } 10998 10999 const RichText = deprecateComponent('RichText', external_wp_blockEditor_["RichText"], ['Content']); 11000 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_["RichText"].isEmpty); 11001 11002 const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_["Autocomplete"]); 11003 const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_["AlignmentToolbar"]); 11004 const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_["BlockAlignmentToolbar"]); 11005 const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_["BlockControls"], ['Slot']); 11006 const deprecated_BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_["BlockEdit"]); 11007 const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_["BlockEditorKeyboardShortcuts"]); 11008 const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_["BlockFormatControls"], ['Slot']); 11009 const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_["BlockIcon"]); 11010 const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_["BlockInspector"]); 11011 const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_["BlockList"]); 11012 const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_["BlockMover"]); 11013 const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_["BlockNavigationDropdown"]); 11014 const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_["BlockSelectionClearer"]); 11015 const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_["BlockSettingsMenu"]); 11016 const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_["BlockTitle"]); 11017 const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_["BlockToolbar"]); 11018 const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_["ColorPalette"]); 11019 const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_["ContrastChecker"]); 11020 const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_["CopyHandler"]); 11021 const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_["DefaultBlockAppender"]); 11022 const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_["FontSizePicker"]); 11023 const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_["Inserter"]); 11024 const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); 11025 const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']); 11026 const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_["InspectorControls"], ['Slot']); 11027 const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_["PanelColorSettings"]); 11028 const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_["PlainText"]); 11029 const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_["RichTextShortcut"]); 11030 const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_["RichTextToolbarButton"]); 11031 const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_["__unstableRichTextInputEvent"]); 11032 const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_["MediaPlaceholder"]); 11033 const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_["MediaUpload"]); 11034 const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_["MediaUploadCheck"]); 11035 const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_["MultiSelectScrollIntoView"]); 11036 const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_["NavigableToolbar"]); 11037 const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_["ObserveTyping"]); 11038 const PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_wp_blockEditor_["PreserveScrollInReorder"]); 11039 const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_["SkipToSelectedBlock"]); 11040 const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_["URLInput"]); 11041 const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_["URLInputButton"]); 11042 const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_["URLPopover"]); 11043 const Warning = deprecateComponent('Warning', external_wp_blockEditor_["Warning"]); 11044 const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_["WritingFlow"]); 11045 const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_["createCustomColorsHOC"]); 11046 const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_["getColorClassName"]); 11047 const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_["getColorObjectByAttributeValues"]); 11048 const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_["getColorObjectByColorValue"]); 11049 const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_["getFontSize"]); 11050 const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_["getFontSizeClass"]); 11051 const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_["withColorContext"]); 11052 const withColors = deprecateFunction('withColors', external_wp_blockEditor_["withColors"]); 11053 const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_["withFontSizes"]); 11054 11055 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js 11056 // Block Creation Components 11057 // Post Related Components 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 // State Related Components 11117 11118 11119 11120 11121 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js 11122 /** 11123 * Internal dependencies 11124 */ 11125 11126 11127 11128 11129 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js 11130 /** 11131 * WordPress dependencies 11132 */ 11133 11134 11135 11136 /** 11137 * Internal dependencies 11138 */ 11139 11140 11141 11142 11143 11144 /* 11145 * Backward compatibility 11146 */ 11147 11148 11149 11150 11151 /***/ }), 11152 11153 /***/ "RMJe": 11154 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11155 11156 "use strict"; 11157 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 11158 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 11159 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 11160 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 11161 11162 11163 /** 11164 * WordPress dependencies 11165 */ 11166 11167 const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 11168 xmlns: "http://www.w3.org/2000/svg", 11169 viewBox: "0 0 24 24" 11170 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 11171 d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z" 11172 })); 11173 /* harmony default export */ __webpack_exports__["a"] = (check); 11174 11175 11176 /***/ }), 11177 11178 /***/ "Rk8H": 11179 /***/ (function(module, exports, __webpack_require__) { 11180 11181 // Load in dependencies 11182 var computedStyle = __webpack_require__("jTPX"); 11183 11184 /** 11185 * Calculate the `line-height` of a given node 11186 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 11187 * @returns {Number} `line-height` of the element in pixels 11188 */ 11189 function lineHeight(node) { 11190 // Grab the line-height via style 11191 var lnHeightStr = computedStyle(node, 'line-height'); 11192 var lnHeight = parseFloat(lnHeightStr, 10); 11193 11194 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 11195 if (lnHeightStr === lnHeight + '') { 11196 // Save the old lineHeight style and update the em unit to the element 11197 var _lnHeightStyle = node.style.lineHeight; 11198 node.style.lineHeight = lnHeightStr + 'em'; 11199 11200 // Calculate the em based height 11201 lnHeightStr = computedStyle(node, 'line-height'); 11202 lnHeight = parseFloat(lnHeightStr, 10); 11203 11204 // Revert the lineHeight style 11205 if (_lnHeightStyle) { 11206 node.style.lineHeight = _lnHeightStyle; 11207 } else { 11208 delete node.style.lineHeight; 11209 } 11210 } 11211 11212 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 11213 // DEV: `em` units are converted to `pt` in IE6 11214 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 11215 if (lnHeightStr.indexOf('pt') !== -1) { 11216 lnHeight *= 4; 11217 lnHeight /= 3; 11218 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 11219 } else if (lnHeightStr.indexOf('mm') !== -1) { 11220 lnHeight *= 96; 11221 lnHeight /= 25.4; 11222 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 11223 } else if (lnHeightStr.indexOf('cm') !== -1) { 11224 lnHeight *= 96; 11225 lnHeight /= 2.54; 11226 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 11227 } else if (lnHeightStr.indexOf('in') !== -1) { 11228 lnHeight *= 96; 11229 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 11230 } else if (lnHeightStr.indexOf('pc') !== -1) { 11231 lnHeight *= 16; 11232 } 11233 11234 // Continue our computation 11235 lnHeight = Math.round(lnHeight); 11236 11237 // If the line-height is "normal", calculate by font-size 11238 if (lnHeightStr === 'normal') { 11239 // Create a temporary node 11240 var nodeName = node.nodeName; 11241 var _node = document.createElement(nodeName); 11242 _node.innerHTML = ' '; 11243 11244 // If we have a text area, reset it to only 1 row 11245 // https://github.com/twolfson/line-height/issues/4 11246 if (nodeName.toUpperCase() === 'TEXTAREA') { 11247 _node.setAttribute('rows', '1'); 11248 } 11249 11250 // Set the font-size of the element 11251 var fontSizeStr = computedStyle(node, 'font-size'); 11252 _node.style.fontSize = fontSizeStr; 11253 11254 // Remove default padding/border which can affect offset height 11255 // https://github.com/twolfson/line-height/issues/4 11256 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 11257 _node.style.padding = '0px'; 11258 _node.style.border = '0px'; 11259 11260 // Append it to the body 11261 var body = document.body; 11262 body.appendChild(_node); 11263 11264 // Assume the line height of the element is the height 11265 var height = _node.offsetHeight; 11266 lnHeight = height; 11267 11268 // Remove our child from the DOM 11269 body.removeChild(_node); 11270 } 11271 11272 // Return the calculated height 11273 return lnHeight; 11274 } 11275 11276 // Export lineHeight 11277 module.exports = lineHeight; 11278 11279 11280 /***/ }), 11281 11282 /***/ "RxS6": 11283 /***/ (function(module, exports) { 11284 11285 (function() { module.exports = window["wp"]["keycodes"]; }()); 11286 11287 /***/ }), 11288 11289 /***/ "TSYQ": 11290 /***/ (function(module, exports, __webpack_require__) { 11291 11292 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 11293 Copyright (c) 2018 Jed Watson. 11294 Licensed under the MIT License (MIT), see 11295 http://jedwatson.github.io/classnames 11296 */ 11297 /* global define */ 11298 11299 (function () { 11300 'use strict'; 11301 11302 var hasOwn = {}.hasOwnProperty; 11303 11304 function classNames() { 11305 var classes = []; 11306 11307 for (var i = 0; i < arguments.length; i++) { 11308 var arg = arguments[i]; 11309 if (!arg) continue; 11310 11311 var argType = typeof arg; 11312 11313 if (argType === 'string' || argType === 'number') { 11314 classes.push(arg); 11315 } else if (Array.isArray(arg)) { 11316 if (arg.length) { 11317 var inner = classNames.apply(null, arg); 11318 if (inner) { 11319 classes.push(inner); 11320 } 11321 } 11322 } else if (argType === 'object') { 11323 if (arg.toString === Object.prototype.toString) { 11324 for (var key in arg) { 11325 if (hasOwn.call(arg, key) && arg[key]) { 11326 classes.push(key); 11327 } 11328 } 11329 } else { 11330 classes.push(arg.toString()); 11331 } 11332 } 11333 } 11334 11335 return classes.join(' '); 11336 } 11337 11338 if ( true && module.exports) { 11339 classNames.default = classNames; 11340 module.exports = classNames; 11341 } else if (true) { 11342 // register as 'classnames', consistent with npm package name 11343 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 11344 return classNames; 11345 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 11346 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 11347 } else {} 11348 }()); 11349 11350 11351 /***/ }), 11352 11353 /***/ "Tqx9": 11354 /***/ (function(module, exports) { 11355 11356 (function() { module.exports = window["wp"]["primitives"]; }()); 11357 11358 /***/ }), 11359 11360 /***/ "WbBG": 11361 /***/ (function(module, exports, __webpack_require__) { 11362 11363 "use strict"; 11364 /** 11365 * Copyright (c) 2013-present, Facebook, Inc. 11366 * 11367 * This source code is licensed under the MIT license found in the 11368 * LICENSE file in the root directory of this source tree. 11369 */ 11370 11371 11372 11373 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 11374 11375 module.exports = ReactPropTypesSecret; 11376 11377 11378 /***/ }), 11379 11380 /***/ "YLtl": 11381 /***/ (function(module, exports) { 11382 11383 (function() { module.exports = window["lodash"]; }()); 11384 11385 /***/ }), 11386 11387 /***/ "axFQ": 11388 /***/ (function(module, exports) { 11389 11390 (function() { module.exports = window["wp"]["blockEditor"]; }()); 11391 11392 /***/ }), 11393 11394 /***/ "bWcr": 11395 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11396 11397 "use strict"; 11398 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 11399 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 11400 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 11401 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 11402 11403 11404 /** 11405 * WordPress dependencies 11406 */ 11407 11408 const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 11409 xmlns: "http://www.w3.org/2000/svg", 11410 viewBox: "0 0 24 24" 11411 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 11412 d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" 11413 })); 11414 /* harmony default export */ __webpack_exports__["a"] = (closeSmall); 11415 11416 11417 /***/ }), 11418 11419 /***/ "cDcd": 11420 /***/ (function(module, exports) { 11421 11422 (function() { module.exports = window["React"]; }()); 11423 11424 /***/ }), 11425 11426 /***/ "diJD": 11427 /***/ (function(module, exports) { 11428 11429 (function() { module.exports = window["wp"]["reusableBlocks"]; }()); 11430 11431 /***/ }), 11432 11433 /***/ "g56x": 11434 /***/ (function(module, exports) { 11435 11436 (function() { module.exports = window["wp"]["hooks"]; }()); 11437 11438 /***/ }), 11439 11440 /***/ "hF7m": 11441 /***/ (function(module, exports) { 11442 11443 (function() { module.exports = window["wp"]["keyboardShortcuts"]; }()); 11444 11445 /***/ }), 11446 11447 /***/ "iClF": 11448 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11449 11450 "use strict"; 11451 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 11452 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 11453 /** 11454 * WordPress dependencies 11455 */ 11456 11457 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 11458 11459 /** 11460 * Return an SVG icon. 11461 * 11462 * @param {IconProps} props icon is the SVG component to render 11463 * size is a number specifiying the icon size in pixels 11464 * Other props will be passed to wrapped SVG component 11465 * 11466 * @return {JSX.Element} Icon component 11467 */ 11468 11469 function Icon({ 11470 icon, 11471 size = 24, 11472 ...props 11473 }) { 11474 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, { 11475 width: size, 11476 height: size, 11477 ...props 11478 }); 11479 } 11480 11481 /* harmony default export */ __webpack_exports__["a"] = (Icon); 11482 11483 11484 /***/ }), 11485 11486 /***/ "jTPX": 11487 /***/ (function(module, exports) { 11488 11489 // This code has been refactored for 140 bytes 11490 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 11491 var computedStyle = function (el, prop, getComputedStyle) { 11492 getComputedStyle = window.getComputedStyle; 11493 11494 // In one fell swoop 11495 return ( 11496 // If we have getComputedStyle 11497 getComputedStyle ? 11498 // Query it 11499 // TODO: From CSS-Query notes, we might need (node, null) for FF 11500 getComputedStyle(el) : 11501 11502 // Otherwise, we are in IE and use currentStyle 11503 el.currentStyle 11504 )[ 11505 // Switch to camelCase for CSSOM 11506 // DEV: Grabbed from jQuery 11507 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 11508 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 11509 prop.replace(/-(\w)/gi, function (word, letter) { 11510 return letter.toUpperCase(); 11511 }) 11512 ]; 11513 }; 11514 11515 module.exports = computedStyle; 11516 11517 11518 /***/ }), 11519 11520 /***/ "jZUy": 11521 /***/ (function(module, exports) { 11522 11523 (function() { module.exports = window["wp"]["coreData"]; }()); 11524 11525 /***/ }), 11526 11527 /***/ "l3Sj": 11528 /***/ (function(module, exports) { 11529 11530 (function() { module.exports = window["wp"]["i18n"]; }()); 11531 11532 /***/ }), 11533 11534 /***/ "onLe": 11535 /***/ (function(module, exports) { 11536 11537 (function() { module.exports = window["wp"]["notices"]; }()); 11538 11539 /***/ }), 11540 11541 /***/ "pPDe": 11542 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11543 11544 "use strict"; 11545 11546 11547 var LEAF_KEY, hasWeakMap; 11548 11549 /** 11550 * Arbitrary value used as key for referencing cache object in WeakMap tree. 11551 * 11552 * @type {Object} 11553 */ 11554 LEAF_KEY = {}; 11555 11556 /** 11557 * Whether environment supports WeakMap. 11558 * 11559 * @type {boolean} 11560 */ 11561 hasWeakMap = typeof WeakMap !== 'undefined'; 11562 11563 /** 11564 * Returns the first argument as the sole entry in an array. 11565 * 11566 * @param {*} value Value to return. 11567 * 11568 * @return {Array} Value returned as entry in array. 11569 */ 11570 function arrayOf( value ) { 11571 return [ value ]; 11572 } 11573 11574 /** 11575 * Returns true if the value passed is object-like, or false otherwise. A value 11576 * is object-like if it can support property assignment, e.g. object or array. 11577 * 11578 * @param {*} value Value to test. 11579 * 11580 * @return {boolean} Whether value is object-like. 11581 */ 11582 function isObjectLike( value ) { 11583 return !! value && 'object' === typeof value; 11584 } 11585 11586 /** 11587 * Creates and returns a new cache object. 11588 * 11589 * @return {Object} Cache object. 11590 */ 11591 function createCache() { 11592 var cache = { 11593 clear: function() { 11594 cache.head = null; 11595 }, 11596 }; 11597 11598 return cache; 11599 } 11600 11601 /** 11602 * Returns true if entries within the two arrays are strictly equal by 11603 * reference from a starting index. 11604 * 11605 * @param {Array} a First array. 11606 * @param {Array} b Second array. 11607 * @param {number} fromIndex Index from which to start comparison. 11608 * 11609 * @return {boolean} Whether arrays are shallowly equal. 11610 */ 11611 function isShallowEqual( a, b, fromIndex ) { 11612 var i; 11613 11614 if ( a.length !== b.length ) { 11615 return false; 11616 } 11617 11618 for ( i = fromIndex; i < a.length; i++ ) { 11619 if ( a[ i ] !== b[ i ] ) { 11620 return false; 11621 } 11622 } 11623 11624 return true; 11625 } 11626 11627 /** 11628 * Returns a memoized selector function. The getDependants function argument is 11629 * called before the memoized selector and is expected to return an immutable 11630 * reference or array of references on which the selector depends for computing 11631 * its own return value. The memoize cache is preserved only as long as those 11632 * dependant references remain the same. If getDependants returns a different 11633 * reference(s), the cache is cleared and the selector value regenerated. 11634 * 11635 * @param {Function} selector Selector function. 11636 * @param {Function} getDependants Dependant getter returning an immutable 11637 * reference or array of reference used in 11638 * cache bust consideration. 11639 * 11640 * @return {Function} Memoized selector. 11641 */ 11642 /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { 11643 var rootCache, getCache; 11644 11645 // Use object source as dependant if getter not provided 11646 if ( ! getDependants ) { 11647 getDependants = arrayOf; 11648 } 11649 11650 /** 11651 * Returns the root cache. If WeakMap is supported, this is assigned to the 11652 * root WeakMap cache set, otherwise it is a shared instance of the default 11653 * cache object. 11654 * 11655 * @return {(WeakMap|Object)} Root cache object. 11656 */ 11657 function getRootCache() { 11658 return rootCache; 11659 } 11660 11661 /** 11662 * Returns the cache for a given dependants array. When possible, a WeakMap 11663 * will be used to create a unique cache for each set of dependants. This 11664 * is feasible due to the nature of WeakMap in allowing garbage collection 11665 * to occur on entries where the key object is no longer referenced. Since 11666 * WeakMap requires the key to be an object, this is only possible when the 11667 * dependant is object-like. The root cache is created as a hierarchy where 11668 * each top-level key is the first entry in a dependants set, the value a 11669 * WeakMap where each key is the next dependant, and so on. This continues 11670 * so long as the dependants are object-like. If no dependants are object- 11671 * like, then the cache is shared across all invocations. 11672 * 11673 * @see isObjectLike 11674 * 11675 * @param {Array} dependants Selector dependants. 11676 * 11677 * @return {Object} Cache object. 11678 */ 11679 function getWeakMapCache( dependants ) { 11680 var caches = rootCache, 11681 isUniqueByDependants = true, 11682 i, dependant, map, cache; 11683 11684 for ( i = 0; i < dependants.length; i++ ) { 11685 dependant = dependants[ i ]; 11686 11687 // Can only compose WeakMap from object-like key. 11688 if ( ! isObjectLike( dependant ) ) { 11689 isUniqueByDependants = false; 11690 break; 11691 } 11692 11693 // Does current segment of cache already have a WeakMap? 11694 if ( caches.has( dependant ) ) { 11695 // Traverse into nested WeakMap. 11696 caches = caches.get( dependant ); 11697 } else { 11698 // Create, set, and traverse into a new one. 11699 map = new WeakMap(); 11700 caches.set( dependant, map ); 11701 caches = map; 11702 } 11703 } 11704 11705 // We use an arbitrary (but consistent) object as key for the last item 11706 // in the WeakMap to serve as our running cache. 11707 if ( ! caches.has( LEAF_KEY ) ) { 11708 cache = createCache(); 11709 cache.isUniqueByDependants = isUniqueByDependants; 11710 caches.set( LEAF_KEY, cache ); 11711 } 11712 11713 return caches.get( LEAF_KEY ); 11714 } 11715 11716 // Assign cache handler by availability of WeakMap 11717 getCache = hasWeakMap ? getWeakMapCache : getRootCache; 11718 11719 /** 11720 * Resets root memoization cache. 11721 */ 11722 function clear() { 11723 rootCache = hasWeakMap ? new WeakMap() : createCache(); 11724 } 11725 11726 // eslint-disable-next-line jsdoc/check-param-names 11727 /** 11728 * The augmented selector call, considering first whether dependants have 11729 * changed before passing it to underlying memoize function. 11730 * 11731 * @param {Object} source Source object for derivation. 11732 * @param {...*} extraArgs Additional arguments to pass to selector. 11733 * 11734 * @return {*} Selector result. 11735 */ 11736 function callSelector( /* source, ...extraArgs */ ) { 11737 var len = arguments.length, 11738 cache, node, i, args, dependants; 11739 11740 // Create copy of arguments (avoid leaking deoptimization). 11741 args = new Array( len ); 11742 for ( i = 0; i < len; i++ ) { 11743 args[ i ] = arguments[ i ]; 11744 } 11745 11746 dependants = getDependants.apply( null, args ); 11747 cache = getCache( dependants ); 11748 11749 // If not guaranteed uniqueness by dependants (primitive type or lack 11750 // of WeakMap support), shallow compare against last dependants and, if 11751 // references have changed, destroy cache to recalculate result. 11752 if ( ! cache.isUniqueByDependants ) { 11753 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { 11754 cache.clear(); 11755 } 11756 11757 cache.lastDependants = dependants; 11758 } 11759 11760 node = cache.head; 11761 while ( node ) { 11762 // Check whether node arguments match arguments 11763 if ( ! isShallowEqual( node.args, args, 1 ) ) { 11764 node = node.next; 11765 continue; 11766 } 11767 11768 // At this point we can assume we've found a match 11769 11770 // Surface matched node to head if not already 11771 if ( node !== cache.head ) { 11772 // Adjust siblings to point to each other. 11773 node.prev.next = node.next; 11774 if ( node.next ) { 11775 node.next.prev = node.prev; 11776 } 11777 11778 node.next = cache.head; 11779 node.prev = null; 11780 cache.head.prev = node; 11781 cache.head = node; 11782 } 11783 11784 // Return immediately 11785 return node.val; 11786 } 11787 11788 // No cached value found. Continue to insertion phase: 11789 11790 node = { 11791 // Generate the result from original function 11792 val: selector.apply( null, args ), 11793 }; 11794 11795 // Avoid including the source object in the cache. 11796 args[ 0 ] = null; 11797 node.args = args; 11798 11799 // Don't need to check whether node is already head, since it would 11800 // have been returned above already if it was 11801 11802 // Shift existing head down list 11803 if ( cache.head ) { 11804 cache.head.prev = node; 11805 node.next = cache.head; 11806 } 11807 11808 cache.head = node; 11809 11810 return node.val; 11811 } 11812 11813 callSelector.getDependants = getDependants; 11814 callSelector.clear = clear; 11815 clear(); 11816 11817 return callSelector; 11818 }); 11819 11820 11821 /***/ }), 11822 11823 /***/ "qRz9": 11824 /***/ (function(module, exports) { 11825 11826 (function() { module.exports = window["wp"]["richText"]; }()); 11827 11828 /***/ }), 11829 11830 /***/ "rmEH": 11831 /***/ (function(module, exports) { 11832 11833 (function() { module.exports = window["wp"]["htmlEntities"]; }()); 11834 11835 /***/ }), 11836 11837 /***/ "tI+e": 11838 /***/ (function(module, exports) { 11839 11840 (function() { module.exports = window["wp"]["components"]; }()); 11841 11842 /***/ }), 11843 11844 /***/ "w95h": 11845 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11846 11847 "use strict"; 11848 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 11849 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 11850 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 11851 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 11852 11853 11854 /** 11855 * WordPress dependencies 11856 */ 11857 11858 const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 11859 xmlns: "http://www.w3.org/2000/svg", 11860 viewBox: "0 0 24 24" 11861 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 11862 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" 11863 })); 11864 /* harmony default export */ __webpack_exports__["a"] = (close); 11865 11866 11867 /***/ }), 11868 11869 /***/ "wduq": 11870 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11871 11872 "use strict"; 11873 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 11874 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 11875 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 11876 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 11877 11878 11879 /** 11880 * WordPress dependencies 11881 */ 11882 11883 const wordpress = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 11884 xmlns: "http://www.w3.org/2000/svg", 11885 viewBox: "-2 -2 24 24" 11886 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 11887 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" 11888 })); 11889 /* harmony default export */ __webpack_exports__["a"] = (wordpress); 11890 11891 11892 /***/ }), 11893 11894 /***/ "wx14": 11895 /***/ (function(module, __webpack_exports__, __webpack_require__) { 11896 11897 "use strict"; 11898 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); 11899 function _extends() { 11900 _extends = Object.assign || function (target) { 11901 for (var i = 1; i < arguments.length; i++) { 11902 var source = arguments[i]; 11903 11904 for (var key in source) { 11905 if (Object.prototype.hasOwnProperty.call(source, key)) { 11906 target[key] = source[key]; 11907 } 11908 } 11909 } 11910 11911 return target; 11912 }; 11913 11914 return _extends.apply(this, arguments); 11915 } 11916 11917 /***/ }), 11918 11919 /***/ "ywyh": 11920 /***/ (function(module, exports) { 11921 11922 (function() { module.exports = window["wp"]["apiFetch"]; }()); 11923 11924 /***/ }) 11925 11926 /******/ });