[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 /******/ (function() { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 6411: 5 /***/ (function(module, exports) { 6 7 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8 autosize 4.0.4 9 license: MIT 10 http://www.jacklmoore.com/autosize 11 */ 12 (function (global, factory) { 13 if (true) { 14 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 15 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 16 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 17 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 18 } else { var mod; } 19 })(this, function (module, exports) { 20 'use strict'; 21 22 var map = typeof Map === "function" ? new Map() : function () { 23 var keys = []; 24 var values = []; 25 26 return { 27 has: function has(key) { 28 return keys.indexOf(key) > -1; 29 }, 30 get: function get(key) { 31 return values[keys.indexOf(key)]; 32 }, 33 set: function set(key, value) { 34 if (keys.indexOf(key) === -1) { 35 keys.push(key); 36 values.push(value); 37 } 38 }, 39 delete: function _delete(key) { 40 var index = keys.indexOf(key); 41 if (index > -1) { 42 keys.splice(index, 1); 43 values.splice(index, 1); 44 } 45 } 46 }; 47 }(); 48 49 var createEvent = function createEvent(name) { 50 return new Event(name, { bubbles: true }); 51 }; 52 try { 53 new Event('test'); 54 } catch (e) { 55 // IE does not support `new Event()` 56 createEvent = function createEvent(name) { 57 var evt = document.createEvent('Event'); 58 evt.initEvent(name, true, false); 59 return evt; 60 }; 61 } 62 63 function assign(ta) { 64 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 65 66 var heightOffset = null; 67 var clientWidth = null; 68 var cachedHeight = null; 69 70 function init() { 71 var style = window.getComputedStyle(ta, null); 72 73 if (style.resize === 'vertical') { 74 ta.style.resize = 'none'; 75 } else if (style.resize === 'both') { 76 ta.style.resize = 'horizontal'; 77 } 78 79 if (style.boxSizing === 'content-box') { 80 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 81 } else { 82 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 83 } 84 // Fix when a textarea is not on document body and heightOffset is Not a Number 85 if (isNaN(heightOffset)) { 86 heightOffset = 0; 87 } 88 89 update(); 90 } 91 92 function changeOverflow(value) { 93 { 94 // Chrome/Safari-specific fix: 95 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 96 // made available by removing the scrollbar. The following forces the necessary text reflow. 97 var width = ta.style.width; 98 ta.style.width = '0px'; 99 // Force reflow: 100 /* jshint ignore:start */ 101 ta.offsetWidth; 102 /* jshint ignore:end */ 103 ta.style.width = width; 104 } 105 106 ta.style.overflowY = value; 107 } 108 109 function getParentOverflows(el) { 110 var arr = []; 111 112 while (el && el.parentNode && el.parentNode instanceof Element) { 113 if (el.parentNode.scrollTop) { 114 arr.push({ 115 node: el.parentNode, 116 scrollTop: el.parentNode.scrollTop 117 }); 118 } 119 el = el.parentNode; 120 } 121 122 return arr; 123 } 124 125 function resize() { 126 if (ta.scrollHeight === 0) { 127 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 128 return; 129 } 130 131 var overflows = getParentOverflows(ta); 132 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 133 134 ta.style.height = ''; 135 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 136 137 // used to check if an update is actually necessary on window.resize 138 clientWidth = ta.clientWidth; 139 140 // prevents scroll-position jumping 141 overflows.forEach(function (el) { 142 el.node.scrollTop = el.scrollTop; 143 }); 144 145 if (docTop) { 146 document.documentElement.scrollTop = docTop; 147 } 148 } 149 150 function update() { 151 resize(); 152 153 var styleHeight = Math.round(parseFloat(ta.style.height)); 154 var computed = window.getComputedStyle(ta, null); 155 156 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 157 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 158 159 // The actual height not matching the style height (set via the resize method) indicates that 160 // the max-height has been exceeded, in which case the overflow should be allowed. 161 if (actualHeight < styleHeight) { 162 if (computed.overflowY === 'hidden') { 163 changeOverflow('scroll'); 164 resize(); 165 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 166 } 167 } else { 168 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 169 if (computed.overflowY !== 'hidden') { 170 changeOverflow('hidden'); 171 resize(); 172 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 173 } 174 } 175 176 if (cachedHeight !== actualHeight) { 177 cachedHeight = actualHeight; 178 var evt = createEvent('autosize:resized'); 179 try { 180 ta.dispatchEvent(evt); 181 } catch (err) { 182 // Firefox will throw an error on dispatchEvent for a detached element 183 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 184 } 185 } 186 } 187 188 var pageResize = function pageResize() { 189 if (ta.clientWidth !== clientWidth) { 190 update(); 191 } 192 }; 193 194 var destroy = function (style) { 195 window.removeEventListener('resize', pageResize, false); 196 ta.removeEventListener('input', update, false); 197 ta.removeEventListener('keyup', update, false); 198 ta.removeEventListener('autosize:destroy', destroy, false); 199 ta.removeEventListener('autosize:update', update, false); 200 201 Object.keys(style).forEach(function (key) { 202 ta.style[key] = style[key]; 203 }); 204 205 map.delete(ta); 206 }.bind(ta, { 207 height: ta.style.height, 208 resize: ta.style.resize, 209 overflowY: ta.style.overflowY, 210 overflowX: ta.style.overflowX, 211 wordWrap: ta.style.wordWrap 212 }); 213 214 ta.addEventListener('autosize:destroy', destroy, false); 215 216 // IE9 does not fire onpropertychange or oninput for deletions, 217 // so binding to onkeyup to catch most of those events. 218 // There is no way that I know of to detect something like 'cut' in IE9. 219 if ('onpropertychange' in ta && 'oninput' in ta) { 220 ta.addEventListener('keyup', update, false); 221 } 222 223 window.addEventListener('resize', pageResize, false); 224 ta.addEventListener('input', update, false); 225 ta.addEventListener('autosize:update', update, false); 226 ta.style.overflowX = 'hidden'; 227 ta.style.wordWrap = 'break-word'; 228 229 map.set(ta, { 230 destroy: destroy, 231 update: update 232 }); 233 234 init(); 235 } 236 237 function destroy(ta) { 238 var methods = map.get(ta); 239 if (methods) { 240 methods.destroy(); 241 } 242 } 243 244 function update(ta) { 245 var methods = map.get(ta); 246 if (methods) { 247 methods.update(); 248 } 249 } 250 251 var autosize = null; 252 253 // Do nothing in Node.js environment and IE8 (or lower) 254 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 255 autosize = function autosize(el) { 256 return el; 257 }; 258 autosize.destroy = function (el) { 259 return el; 260 }; 261 autosize.update = function (el) { 262 return el; 263 }; 264 } else { 265 autosize = function autosize(el, options) { 266 if (el) { 267 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 268 return assign(x, options); 269 }); 270 } 271 return el; 272 }; 273 autosize.destroy = function (el) { 274 if (el) { 275 Array.prototype.forEach.call(el.length ? el : [el], destroy); 276 } 277 return el; 278 }; 279 autosize.update = function (el) { 280 if (el) { 281 Array.prototype.forEach.call(el.length ? el : [el], update); 282 } 283 return el; 284 }; 285 } 286 287 exports.default = autosize; 288 module.exports = exports['default']; 289 }); 290 291 /***/ }), 292 293 /***/ 4403: 294 /***/ (function(module, exports) { 295 296 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 297 Copyright (c) 2018 Jed Watson. 298 Licensed under the MIT License (MIT), see 299 http://jedwatson.github.io/classnames 300 */ 301 /* global define */ 302 303 (function () { 304 'use strict'; 305 306 var hasOwn = {}.hasOwnProperty; 307 308 function classNames() { 309 var classes = []; 310 311 for (var i = 0; i < arguments.length; i++) { 312 var arg = arguments[i]; 313 if (!arg) continue; 314 315 var argType = typeof arg; 316 317 if (argType === 'string' || argType === 'number') { 318 classes.push(arg); 319 } else if (Array.isArray(arg)) { 320 if (arg.length) { 321 var inner = classNames.apply(null, arg); 322 if (inner) { 323 classes.push(inner); 324 } 325 } 326 } else if (argType === 'object') { 327 if (arg.toString === Object.prototype.toString) { 328 for (var key in arg) { 329 if (hasOwn.call(arg, key) && arg[key]) { 330 classes.push(key); 331 } 332 } 333 } else { 334 classes.push(arg.toString()); 335 } 336 } 337 } 338 339 return classes.join(' '); 340 } 341 342 if ( true && module.exports) { 343 classNames.default = classNames; 344 module.exports = classNames; 345 } else if (true) { 346 // register as 'classnames', consistent with npm package name 347 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 348 return classNames; 349 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 350 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 351 } else {} 352 }()); 353 354 355 /***/ }), 356 357 /***/ 4827: 358 /***/ (function(module) { 359 360 // This code has been refactored for 140 bytes 361 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 362 var computedStyle = function (el, prop, getComputedStyle) { 363 getComputedStyle = window.getComputedStyle; 364 365 // In one fell swoop 366 return ( 367 // If we have getComputedStyle 368 getComputedStyle ? 369 // Query it 370 // TODO: From CSS-Query notes, we might need (node, null) for FF 371 getComputedStyle(el) : 372 373 // Otherwise, we are in IE and use currentStyle 374 el.currentStyle 375 )[ 376 // Switch to camelCase for CSSOM 377 // DEV: Grabbed from jQuery 378 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 379 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 380 prop.replace(/-(\w)/gi, function (word, letter) { 381 return letter.toUpperCase(); 382 }) 383 ]; 384 }; 385 386 module.exports = computedStyle; 387 388 389 /***/ }), 390 391 /***/ 9894: 392 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 393 394 // Load in dependencies 395 var computedStyle = __webpack_require__(4827); 396 397 /** 398 * Calculate the `line-height` of a given node 399 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 400 * @returns {Number} `line-height` of the element in pixels 401 */ 402 function lineHeight(node) { 403 // Grab the line-height via style 404 var lnHeightStr = computedStyle(node, 'line-height'); 405 var lnHeight = parseFloat(lnHeightStr, 10); 406 407 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 408 if (lnHeightStr === lnHeight + '') { 409 // Save the old lineHeight style and update the em unit to the element 410 var _lnHeightStyle = node.style.lineHeight; 411 node.style.lineHeight = lnHeightStr + 'em'; 412 413 // Calculate the em based height 414 lnHeightStr = computedStyle(node, 'line-height'); 415 lnHeight = parseFloat(lnHeightStr, 10); 416 417 // Revert the lineHeight style 418 if (_lnHeightStyle) { 419 node.style.lineHeight = _lnHeightStyle; 420 } else { 421 delete node.style.lineHeight; 422 } 423 } 424 425 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 426 // DEV: `em` units are converted to `pt` in IE6 427 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 428 if (lnHeightStr.indexOf('pt') !== -1) { 429 lnHeight *= 4; 430 lnHeight /= 3; 431 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 432 } else if (lnHeightStr.indexOf('mm') !== -1) { 433 lnHeight *= 96; 434 lnHeight /= 25.4; 435 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 436 } else if (lnHeightStr.indexOf('cm') !== -1) { 437 lnHeight *= 96; 438 lnHeight /= 2.54; 439 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 440 } else if (lnHeightStr.indexOf('in') !== -1) { 441 lnHeight *= 96; 442 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 443 } else if (lnHeightStr.indexOf('pc') !== -1) { 444 lnHeight *= 16; 445 } 446 447 // Continue our computation 448 lnHeight = Math.round(lnHeight); 449 450 // If the line-height is "normal", calculate by font-size 451 if (lnHeightStr === 'normal') { 452 // Create a temporary node 453 var nodeName = node.nodeName; 454 var _node = document.createElement(nodeName); 455 _node.innerHTML = ' '; 456 457 // If we have a text area, reset it to only 1 row 458 // https://github.com/twolfson/line-height/issues/4 459 if (nodeName.toUpperCase() === 'TEXTAREA') { 460 _node.setAttribute('rows', '1'); 461 } 462 463 // Set the font-size of the element 464 var fontSizeStr = computedStyle(node, 'font-size'); 465 _node.style.fontSize = fontSizeStr; 466 467 // Remove default padding/border which can affect offset height 468 // https://github.com/twolfson/line-height/issues/4 469 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 470 _node.style.padding = '0px'; 471 _node.style.border = '0px'; 472 473 // Append it to the body 474 var body = document.body; 475 body.appendChild(_node); 476 477 // Assume the line height of the element is the height 478 var height = _node.offsetHeight; 479 lnHeight = height; 480 481 // Remove our child from the DOM 482 body.removeChild(_node); 483 } 484 485 // Return the calculated height 486 return lnHeight; 487 } 488 489 // Export lineHeight 490 module.exports = lineHeight; 491 492 493 /***/ }), 494 495 /***/ 5372: 496 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 497 498 "use strict"; 499 /** 500 * Copyright (c) 2013-present, Facebook, Inc. 501 * 502 * This source code is licensed under the MIT license found in the 503 * LICENSE file in the root directory of this source tree. 504 */ 505 506 507 508 var ReactPropTypesSecret = __webpack_require__(9567); 509 510 function emptyFunction() {} 511 function emptyFunctionWithReset() {} 512 emptyFunctionWithReset.resetWarningCache = emptyFunction; 513 514 module.exports = function() { 515 function shim(props, propName, componentName, location, propFullName, secret) { 516 if (secret === ReactPropTypesSecret) { 517 // It is still safe when called from React. 518 return; 519 } 520 var err = new Error( 521 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 522 'Use PropTypes.checkPropTypes() to call them. ' + 523 'Read more at http://fb.me/use-check-prop-types' 524 ); 525 err.name = 'Invariant Violation'; 526 throw err; 527 }; 528 shim.isRequired = shim; 529 function getShim() { 530 return shim; 531 }; 532 // Important! 533 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 534 var ReactPropTypes = { 535 array: shim, 536 bigint: shim, 537 bool: shim, 538 func: shim, 539 number: shim, 540 object: shim, 541 string: shim, 542 symbol: shim, 543 544 any: shim, 545 arrayOf: getShim, 546 element: shim, 547 elementType: shim, 548 instanceOf: getShim, 549 node: shim, 550 objectOf: getShim, 551 oneOf: getShim, 552 oneOfType: getShim, 553 shape: getShim, 554 exact: getShim, 555 556 checkPropTypes: emptyFunctionWithReset, 557 resetWarningCache: emptyFunction 558 }; 559 560 ReactPropTypes.PropTypes = ReactPropTypes; 561 562 return ReactPropTypes; 563 }; 564 565 566 /***/ }), 567 568 /***/ 2652: 569 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 570 571 /** 572 * Copyright (c) 2013-present, Facebook, Inc. 573 * 574 * This source code is licensed under the MIT license found in the 575 * LICENSE file in the root directory of this source tree. 576 */ 577 578 if (false) { var throwOnDirectAccess, ReactIs; } else { 579 // By explicitly using `prop-types` you are opting into new production behavior. 580 // http://fb.me/prop-types-in-prod 581 module.exports = __webpack_require__(5372)(); 582 } 583 584 585 /***/ }), 586 587 /***/ 9567: 588 /***/ (function(module) { 589 590 "use strict"; 591 /** 592 * Copyright (c) 2013-present, Facebook, Inc. 593 * 594 * This source code is licensed under the MIT license found in the 595 * LICENSE file in the root directory of this source tree. 596 */ 597 598 599 600 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 601 602 module.exports = ReactPropTypesSecret; 603 604 605 /***/ }), 606 607 /***/ 5438: 608 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 609 610 "use strict"; 611 612 var __extends = (this && this.__extends) || (function () { 613 var extendStatics = Object.setPrototypeOf || 614 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 615 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 616 return function (d, b) { 617 extendStatics(d, b); 618 function __() { this.constructor = d; } 619 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 620 }; 621 })(); 622 var __assign = (this && this.__assign) || Object.assign || function(t) { 623 for (var s, i = 1, n = arguments.length; i < n; i++) { 624 s = arguments[i]; 625 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 626 t[p] = s[p]; 627 } 628 return t; 629 }; 630 var __rest = (this && this.__rest) || function (s, e) { 631 var t = {}; 632 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 633 t[p] = s[p]; 634 if (s != null && typeof Object.getOwnPropertySymbols === "function") 635 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 636 t[p[i]] = s[p[i]]; 637 return t; 638 }; 639 exports.__esModule = true; 640 var React = __webpack_require__(9196); 641 var PropTypes = __webpack_require__(2652); 642 var autosize = __webpack_require__(6411); 643 var _getLineHeight = __webpack_require__(9894); 644 var getLineHeight = _getLineHeight; 645 var RESIZED = "autosize:resized"; 646 /** 647 * A light replacement for built-in textarea component 648 * which automaticaly adjusts its height to match the content 649 */ 650 var TextareaAutosizeClass = /** @class */ (function (_super) { 651 __extends(TextareaAutosizeClass, _super); 652 function TextareaAutosizeClass() { 653 var _this = _super !== null && _super.apply(this, arguments) || this; 654 _this.state = { 655 lineHeight: null 656 }; 657 _this.textarea = null; 658 _this.onResize = function (e) { 659 if (_this.props.onResize) { 660 _this.props.onResize(e); 661 } 662 }; 663 _this.updateLineHeight = function () { 664 if (_this.textarea) { 665 _this.setState({ 666 lineHeight: getLineHeight(_this.textarea) 667 }); 668 } 669 }; 670 _this.onChange = function (e) { 671 var onChange = _this.props.onChange; 672 _this.currentValue = e.currentTarget.value; 673 onChange && onChange(e); 674 }; 675 return _this; 676 } 677 TextareaAutosizeClass.prototype.componentDidMount = function () { 678 var _this = this; 679 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 680 if (typeof maxRows === "number") { 681 this.updateLineHeight(); 682 } 683 if (typeof maxRows === "number" || async) { 684 /* 685 the defer is needed to: 686 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 687 - support StyledComponents (see #71) 688 */ 689 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 690 } 691 else { 692 this.textarea && autosize(this.textarea); 693 } 694 if (this.textarea) { 695 this.textarea.addEventListener(RESIZED, this.onResize); 696 } 697 }; 698 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 699 if (this.textarea) { 700 this.textarea.removeEventListener(RESIZED, this.onResize); 701 autosize.destroy(this.textarea); 702 } 703 }; 704 TextareaAutosizeClass.prototype.render = function () { 705 var _this = this; 706 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; 707 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 708 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 709 _this.textarea = element; 710 if (typeof _this.props.innerRef === 'function') { 711 _this.props.innerRef(element); 712 } 713 else if (_this.props.innerRef) { 714 _this.props.innerRef.current = element; 715 } 716 } }), children)); 717 }; 718 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 719 this.textarea && autosize.update(this.textarea); 720 }; 721 TextareaAutosizeClass.defaultProps = { 722 rows: 1, 723 async: false 724 }; 725 TextareaAutosizeClass.propTypes = { 726 rows: PropTypes.number, 727 maxRows: PropTypes.number, 728 onResize: PropTypes.func, 729 innerRef: PropTypes.any, 730 async: PropTypes.bool 731 }; 732 return TextareaAutosizeClass; 733 }(React.Component)); 734 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 735 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 736 }); 737 738 739 /***/ }), 740 741 /***/ 773: 742 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 743 744 "use strict"; 745 var __webpack_unused_export__; 746 747 __webpack_unused_export__ = true; 748 var TextareaAutosize_1 = __webpack_require__(5438); 749 exports.Z = TextareaAutosize_1.TextareaAutosize; 750 751 752 /***/ }), 753 754 /***/ 9196: 755 /***/ (function(module) { 756 757 "use strict"; 758 module.exports = window["React"]; 759 760 /***/ }) 761 762 /******/ }); 763 /************************************************************************/ 764 /******/ // The module cache 765 /******/ var __webpack_module_cache__ = {}; 766 /******/ 767 /******/ // The require function 768 /******/ function __webpack_require__(moduleId) { 769 /******/ // Check if module is in cache 770 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 771 /******/ if (cachedModule !== undefined) { 772 /******/ return cachedModule.exports; 773 /******/ } 774 /******/ // Create a new module (and put it into the cache) 775 /******/ var module = __webpack_module_cache__[moduleId] = { 776 /******/ // no module.id needed 777 /******/ // no module.loaded needed 778 /******/ exports: {} 779 /******/ }; 780 /******/ 781 /******/ // Execute the module function 782 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 783 /******/ 784 /******/ // Return the exports of the module 785 /******/ return module.exports; 786 /******/ } 787 /******/ 788 /************************************************************************/ 789 /******/ /* webpack/runtime/compat get default export */ 790 /******/ !function() { 791 /******/ // getDefaultExport function for compatibility with non-harmony modules 792 /******/ __webpack_require__.n = function(module) { 793 /******/ var getter = module && module.__esModule ? 794 /******/ function() { return module['default']; } : 795 /******/ function() { return module; }; 796 /******/ __webpack_require__.d(getter, { a: getter }); 797 /******/ return getter; 798 /******/ }; 799 /******/ }(); 800 /******/ 801 /******/ /* webpack/runtime/define property getters */ 802 /******/ !function() { 803 /******/ // define getter functions for harmony exports 804 /******/ __webpack_require__.d = function(exports, definition) { 805 /******/ for(var key in definition) { 806 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 807 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 808 /******/ } 809 /******/ } 810 /******/ }; 811 /******/ }(); 812 /******/ 813 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 814 /******/ !function() { 815 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 816 /******/ }(); 817 /******/ 818 /******/ /* webpack/runtime/make namespace object */ 819 /******/ !function() { 820 /******/ // define __esModule on exports 821 /******/ __webpack_require__.r = function(exports) { 822 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 823 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 824 /******/ } 825 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 826 /******/ }; 827 /******/ }(); 828 /******/ 829 /************************************************************************/ 830 var __webpack_exports__ = {}; 831 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 832 !function() { 833 "use strict"; 834 // ESM COMPAT FLAG 835 __webpack_require__.r(__webpack_exports__); 836 837 // EXPORTS 838 __webpack_require__.d(__webpack_exports__, { 839 "AlignmentToolbar": function() { return /* reexport */ AlignmentToolbar; }, 840 "Autocomplete": function() { return /* reexport */ Autocomplete; }, 841 "AutosaveMonitor": function() { return /* reexport */ autosave_monitor; }, 842 "BlockAlignmentToolbar": function() { return /* reexport */ BlockAlignmentToolbar; }, 843 "BlockControls": function() { return /* reexport */ BlockControls; }, 844 "BlockEdit": function() { return /* reexport */ BlockEdit; }, 845 "BlockEditorKeyboardShortcuts": function() { return /* reexport */ BlockEditorKeyboardShortcuts; }, 846 "BlockFormatControls": function() { return /* reexport */ BlockFormatControls; }, 847 "BlockIcon": function() { return /* reexport */ BlockIcon; }, 848 "BlockInspector": function() { return /* reexport */ BlockInspector; }, 849 "BlockList": function() { return /* reexport */ BlockList; }, 850 "BlockMover": function() { return /* reexport */ BlockMover; }, 851 "BlockNavigationDropdown": function() { return /* reexport */ BlockNavigationDropdown; }, 852 "BlockSelectionClearer": function() { return /* reexport */ BlockSelectionClearer; }, 853 "BlockSettingsMenu": function() { return /* reexport */ BlockSettingsMenu; }, 854 "BlockTitle": function() { return /* reexport */ BlockTitle; }, 855 "BlockToolbar": function() { return /* reexport */ BlockToolbar; }, 856 "ColorPalette": function() { return /* reexport */ ColorPalette; }, 857 "ContrastChecker": function() { return /* reexport */ ContrastChecker; }, 858 "CopyHandler": function() { return /* reexport */ CopyHandler; }, 859 "DefaultBlockAppender": function() { return /* reexport */ DefaultBlockAppender; }, 860 "DocumentOutline": function() { return /* reexport */ document_outline; }, 861 "DocumentOutlineCheck": function() { return /* reexport */ check; }, 862 "EditorHistoryRedo": function() { return /* reexport */ editor_history_redo; }, 863 "EditorHistoryUndo": function() { return /* reexport */ editor_history_undo; }, 864 "EditorKeyboardShortcutsRegister": function() { return /* reexport */ register_shortcuts; }, 865 "EditorNotices": function() { return /* reexport */ editor_notices; }, 866 "EditorProvider": function() { return /* reexport */ provider; }, 867 "EditorSnackbars": function() { return /* reexport */ EditorSnackbars; }, 868 "EntitiesSavedStates": function() { return /* reexport */ EntitiesSavedStates; }, 869 "ErrorBoundary": function() { return /* reexport */ error_boundary; }, 870 "FontSizePicker": function() { return /* reexport */ FontSizePicker; }, 871 "InnerBlocks": function() { return /* reexport */ InnerBlocks; }, 872 "Inserter": function() { return /* reexport */ Inserter; }, 873 "InspectorAdvancedControls": function() { return /* reexport */ InspectorAdvancedControls; }, 874 "InspectorControls": function() { return /* reexport */ InspectorControls; }, 875 "LocalAutosaveMonitor": function() { return /* reexport */ local_autosave_monitor; }, 876 "MediaPlaceholder": function() { return /* reexport */ MediaPlaceholder; }, 877 "MediaUpload": function() { return /* reexport */ MediaUpload; }, 878 "MediaUploadCheck": function() { return /* reexport */ MediaUploadCheck; }, 879 "MultiSelectScrollIntoView": function() { return /* reexport */ MultiSelectScrollIntoView; }, 880 "NavigableToolbar": function() { return /* reexport */ NavigableToolbar; }, 881 "ObserveTyping": function() { return /* reexport */ ObserveTyping; }, 882 "PageAttributesCheck": function() { return /* reexport */ page_attributes_check; }, 883 "PageAttributesOrder": function() { return /* reexport */ order; }, 884 "PageAttributesParent": function() { return /* reexport */ page_attributes_parent; }, 885 "PageTemplate": function() { return /* reexport */ post_template; }, 886 "PanelColorSettings": function() { return /* reexport */ PanelColorSettings; }, 887 "PlainText": function() { return /* reexport */ PlainText; }, 888 "PostAuthor": function() { return /* reexport */ post_author; }, 889 "PostAuthorCheck": function() { return /* reexport */ PostAuthorCheck; }, 890 "PostComments": function() { return /* reexport */ post_comments; }, 891 "PostExcerpt": function() { return /* reexport */ post_excerpt; }, 892 "PostExcerptCheck": function() { return /* reexport */ post_excerpt_check; }, 893 "PostFeaturedImage": function() { return /* reexport */ post_featured_image; }, 894 "PostFeaturedImageCheck": function() { return /* reexport */ post_featured_image_check; }, 895 "PostFormat": function() { return /* reexport */ PostFormat; }, 896 "PostFormatCheck": function() { return /* reexport */ post_format_check; }, 897 "PostLastRevision": function() { return /* reexport */ post_last_revision; }, 898 "PostLastRevisionCheck": function() { return /* reexport */ post_last_revision_check; }, 899 "PostLockedModal": function() { return /* reexport */ PostLockedModal; }, 900 "PostPendingStatus": function() { return /* reexport */ post_pending_status; }, 901 "PostPendingStatusCheck": function() { return /* reexport */ post_pending_status_check; }, 902 "PostPingbacks": function() { return /* reexport */ post_pingbacks; }, 903 "PostPreviewButton": function() { return /* reexport */ post_preview_button; }, 904 "PostPublishButton": function() { return /* reexport */ post_publish_button; }, 905 "PostPublishButtonLabel": function() { return /* reexport */ label; }, 906 "PostPublishPanel": function() { return /* reexport */ post_publish_panel; }, 907 "PostSavedState": function() { return /* reexport */ PostSavedState; }, 908 "PostSchedule": function() { return /* reexport */ PostSchedule; }, 909 "PostScheduleCheck": function() { return /* reexport */ post_schedule_check; }, 910 "PostScheduleLabel": function() { return /* reexport */ post_schedule_label; }, 911 "PostSlug": function() { return /* reexport */ post_slug; }, 912 "PostSlugCheck": function() { return /* reexport */ PostSlugCheck; }, 913 "PostSticky": function() { return /* reexport */ post_sticky; }, 914 "PostStickyCheck": function() { return /* reexport */ post_sticky_check; }, 915 "PostSwitchToDraftButton": function() { return /* reexport */ post_switch_to_draft_button; }, 916 "PostTaxonomies": function() { return /* reexport */ post_taxonomies; }, 917 "PostTaxonomiesCheck": function() { return /* reexport */ post_taxonomies_check; }, 918 "PostTaxonomiesFlatTermSelector": function() { return /* reexport */ flat_term_selector; }, 919 "PostTaxonomiesHierarchicalTermSelector": function() { return /* reexport */ hierarchical_term_selector; }, 920 "PostTextEditor": function() { return /* reexport */ PostTextEditor; }, 921 "PostTitle": function() { return /* reexport */ PostTitle; }, 922 "PostTrash": function() { return /* reexport */ PostTrash; }, 923 "PostTrashCheck": function() { return /* reexport */ post_trash_check; }, 924 "PostTypeSupportCheck": function() { return /* reexport */ post_type_support_check; }, 925 "PostVisibility": function() { return /* reexport */ post_visibility; }, 926 "PostVisibilityCheck": function() { return /* reexport */ post_visibility_check; }, 927 "PostVisibilityLabel": function() { return /* reexport */ post_visibility_label; }, 928 "RichText": function() { return /* reexport */ RichText; }, 929 "RichTextShortcut": function() { return /* reexport */ RichTextShortcut; }, 930 "RichTextToolbarButton": function() { return /* reexport */ RichTextToolbarButton; }, 931 "ServerSideRender": function() { return /* reexport */ (external_wp_serverSideRender_default()); }, 932 "SkipToSelectedBlock": function() { return /* reexport */ SkipToSelectedBlock; }, 933 "TableOfContents": function() { return /* reexport */ table_of_contents; }, 934 "TextEditorGlobalKeyboardShortcuts": function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; }, 935 "ThemeSupportCheck": function() { return /* reexport */ theme_support_check; }, 936 "URLInput": function() { return /* reexport */ URLInput; }, 937 "URLInputButton": function() { return /* reexport */ URLInputButton; }, 938 "URLPopover": function() { return /* reexport */ URLPopover; }, 939 "UnsavedChangesWarning": function() { return /* reexport */ UnsavedChangesWarning; }, 940 "VisualEditorGlobalKeyboardShortcuts": function() { return /* reexport */ visual_editor_shortcuts; }, 941 "Warning": function() { return /* reexport */ Warning; }, 942 "WordCount": function() { return /* reexport */ WordCount; }, 943 "WritingFlow": function() { return /* reexport */ WritingFlow; }, 944 "__unstableRichTextInputEvent": function() { return /* reexport */ __unstableRichTextInputEvent; }, 945 "cleanForSlug": function() { return /* reexport */ cleanForSlug; }, 946 "createCustomColorsHOC": function() { return /* reexport */ createCustomColorsHOC; }, 947 "getColorClassName": function() { return /* reexport */ getColorClassName; }, 948 "getColorObjectByAttributeValues": function() { return /* reexport */ getColorObjectByAttributeValues; }, 949 "getColorObjectByColorValue": function() { return /* reexport */ getColorObjectByColorValue; }, 950 "getFontSize": function() { return /* reexport */ getFontSize; }, 951 "getFontSizeClass": function() { return /* reexport */ getFontSizeClass; }, 952 "getTemplatePartIcon": function() { return /* reexport */ getTemplatePartIcon; }, 953 "mediaUpload": function() { return /* reexport */ mediaUpload; }, 954 "store": function() { return /* reexport */ store_store; }, 955 "storeConfig": function() { return /* reexport */ storeConfig; }, 956 "transformStyles": function() { return /* reexport */ external_wp_blockEditor_namespaceObject.transformStyles; }, 957 "userAutocompleter": function() { return /* reexport */ user; }, 958 "withColorContext": function() { return /* reexport */ withColorContext; }, 959 "withColors": function() { return /* reexport */ withColors; }, 960 "withFontSizes": function() { return /* reexport */ withFontSizes; } 961 }); 962 963 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js 964 var selectors_namespaceObject = {}; 965 __webpack_require__.r(selectors_namespaceObject); 966 __webpack_require__.d(selectors_namespaceObject, { 967 "__experimentalGetDefaultTemplatePartAreas": function() { return __experimentalGetDefaultTemplatePartAreas; }, 968 "__experimentalGetDefaultTemplateType": function() { return __experimentalGetDefaultTemplateType; }, 969 "__experimentalGetDefaultTemplateTypes": function() { return __experimentalGetDefaultTemplateTypes; }, 970 "__experimentalGetTemplateInfo": function() { return __experimentalGetTemplateInfo; }, 971 "__unstableIsEditorReady": function() { return __unstableIsEditorReady; }, 972 "canInsertBlockType": function() { return canInsertBlockType; }, 973 "canUserUseUnfilteredHTML": function() { return canUserUseUnfilteredHTML; }, 974 "didPostSaveRequestFail": function() { return didPostSaveRequestFail; }, 975 "didPostSaveRequestSucceed": function() { return didPostSaveRequestSucceed; }, 976 "getActivePostLock": function() { return getActivePostLock; }, 977 "getAdjacentBlockClientId": function() { return getAdjacentBlockClientId; }, 978 "getAutosaveAttribute": function() { return getAutosaveAttribute; }, 979 "getBlock": function() { return getBlock; }, 980 "getBlockAttributes": function() { return getBlockAttributes; }, 981 "getBlockCount": function() { return getBlockCount; }, 982 "getBlockHierarchyRootClientId": function() { return getBlockHierarchyRootClientId; }, 983 "getBlockIndex": function() { return getBlockIndex; }, 984 "getBlockInsertionPoint": function() { return getBlockInsertionPoint; }, 985 "getBlockListSettings": function() { return getBlockListSettings; }, 986 "getBlockMode": function() { return getBlockMode; }, 987 "getBlockName": function() { return getBlockName; }, 988 "getBlockOrder": function() { return getBlockOrder; }, 989 "getBlockRootClientId": function() { return getBlockRootClientId; }, 990 "getBlockSelectionEnd": function() { return getBlockSelectionEnd; }, 991 "getBlockSelectionStart": function() { return getBlockSelectionStart; }, 992 "getBlocks": function() { return getBlocks; }, 993 "getBlocksByClientId": function() { return getBlocksByClientId; }, 994 "getClientIdsOfDescendants": function() { return getClientIdsOfDescendants; }, 995 "getClientIdsWithDescendants": function() { return getClientIdsWithDescendants; }, 996 "getCurrentPost": function() { return getCurrentPost; }, 997 "getCurrentPostAttribute": function() { return getCurrentPostAttribute; }, 998 "getCurrentPostId": function() { return getCurrentPostId; }, 999 "getCurrentPostLastRevisionId": function() { return getCurrentPostLastRevisionId; }, 1000 "getCurrentPostRevisionsCount": function() { return getCurrentPostRevisionsCount; }, 1001 "getCurrentPostType": function() { return getCurrentPostType; }, 1002 "getEditedPostAttribute": function() { return getEditedPostAttribute; }, 1003 "getEditedPostContent": function() { return getEditedPostContent; }, 1004 "getEditedPostPreviewLink": function() { return getEditedPostPreviewLink; }, 1005 "getEditedPostSlug": function() { return getEditedPostSlug; }, 1006 "getEditedPostVisibility": function() { return getEditedPostVisibility; }, 1007 "getEditorBlocks": function() { return getEditorBlocks; }, 1008 "getEditorSelection": function() { return getEditorSelection; }, 1009 "getEditorSelectionEnd": function() { return getEditorSelectionEnd; }, 1010 "getEditorSelectionStart": function() { return getEditorSelectionStart; }, 1011 "getEditorSettings": function() { return getEditorSettings; }, 1012 "getFirstMultiSelectedBlockClientId": function() { return getFirstMultiSelectedBlockClientId; }, 1013 "getGlobalBlockCount": function() { return getGlobalBlockCount; }, 1014 "getInserterItems": function() { return getInserterItems; }, 1015 "getLastMultiSelectedBlockClientId": function() { return getLastMultiSelectedBlockClientId; }, 1016 "getMultiSelectedBlockClientIds": function() { return getMultiSelectedBlockClientIds; }, 1017 "getMultiSelectedBlocks": function() { return getMultiSelectedBlocks; }, 1018 "getMultiSelectedBlocksEndClientId": function() { return getMultiSelectedBlocksEndClientId; }, 1019 "getMultiSelectedBlocksStartClientId": function() { return getMultiSelectedBlocksStartClientId; }, 1020 "getNextBlockClientId": function() { return getNextBlockClientId; }, 1021 "getPermalink": function() { return getPermalink; }, 1022 "getPermalinkParts": function() { return getPermalinkParts; }, 1023 "getPostEdits": function() { return getPostEdits; }, 1024 "getPostLockUser": function() { return getPostLockUser; }, 1025 "getPostTypeLabel": function() { return getPostTypeLabel; }, 1026 "getPreviousBlockClientId": function() { return getPreviousBlockClientId; }, 1027 "getSelectedBlock": function() { return getSelectedBlock; }, 1028 "getSelectedBlockClientId": function() { return getSelectedBlockClientId; }, 1029 "getSelectedBlockCount": function() { return getSelectedBlockCount; }, 1030 "getSelectedBlocksInitialCaretPosition": function() { return getSelectedBlocksInitialCaretPosition; }, 1031 "getStateBeforeOptimisticTransaction": function() { return getStateBeforeOptimisticTransaction; }, 1032 "getSuggestedPostFormat": function() { return getSuggestedPostFormat; }, 1033 "getTemplate": function() { return getTemplate; }, 1034 "getTemplateLock": function() { return getTemplateLock; }, 1035 "hasChangedContent": function() { return hasChangedContent; }, 1036 "hasEditorRedo": function() { return hasEditorRedo; }, 1037 "hasEditorUndo": function() { return hasEditorUndo; }, 1038 "hasInserterItems": function() { return hasInserterItems; }, 1039 "hasMultiSelection": function() { return hasMultiSelection; }, 1040 "hasNonPostEntityChanges": function() { return hasNonPostEntityChanges; }, 1041 "hasSelectedBlock": function() { return hasSelectedBlock; }, 1042 "hasSelectedInnerBlock": function() { return hasSelectedInnerBlock; }, 1043 "inSomeHistory": function() { return inSomeHistory; }, 1044 "isAncestorMultiSelected": function() { return isAncestorMultiSelected; }, 1045 "isAutosavingPost": function() { return isAutosavingPost; }, 1046 "isBlockInsertionPointVisible": function() { return isBlockInsertionPointVisible; }, 1047 "isBlockMultiSelected": function() { return isBlockMultiSelected; }, 1048 "isBlockSelected": function() { return isBlockSelected; }, 1049 "isBlockValid": function() { return isBlockValid; }, 1050 "isBlockWithinSelection": function() { return isBlockWithinSelection; }, 1051 "isCaretWithinFormattedText": function() { return isCaretWithinFormattedText; }, 1052 "isCleanNewPost": function() { return isCleanNewPost; }, 1053 "isCurrentPostPending": function() { return isCurrentPostPending; }, 1054 "isCurrentPostPublished": function() { return isCurrentPostPublished; }, 1055 "isCurrentPostScheduled": function() { return isCurrentPostScheduled; }, 1056 "isEditedPostAutosaveable": function() { return isEditedPostAutosaveable; }, 1057 "isEditedPostBeingScheduled": function() { return isEditedPostBeingScheduled; }, 1058 "isEditedPostDateFloating": function() { return isEditedPostDateFloating; }, 1059 "isEditedPostDirty": function() { return isEditedPostDirty; }, 1060 "isEditedPostEmpty": function() { return isEditedPostEmpty; }, 1061 "isEditedPostNew": function() { return isEditedPostNew; }, 1062 "isEditedPostPublishable": function() { return isEditedPostPublishable; }, 1063 "isEditedPostSaveable": function() { return isEditedPostSaveable; }, 1064 "isFirstMultiSelectedBlock": function() { return isFirstMultiSelectedBlock; }, 1065 "isMultiSelecting": function() { return isMultiSelecting; }, 1066 "isPermalinkEditable": function() { return isPermalinkEditable; }, 1067 "isPostAutosavingLocked": function() { return isPostAutosavingLocked; }, 1068 "isPostLockTakeover": function() { return isPostLockTakeover; }, 1069 "isPostLocked": function() { return isPostLocked; }, 1070 "isPostSavingLocked": function() { return isPostSavingLocked; }, 1071 "isPreviewingPost": function() { return isPreviewingPost; }, 1072 "isPublishSidebarEnabled": function() { return isPublishSidebarEnabled; }, 1073 "isPublishingPost": function() { return isPublishingPost; }, 1074 "isSavingNonPostEntityChanges": function() { return isSavingNonPostEntityChanges; }, 1075 "isSavingPost": function() { return isSavingPost; }, 1076 "isSelectionEnabled": function() { return isSelectionEnabled; }, 1077 "isTyping": function() { return isTyping; }, 1078 "isValidTemplate": function() { return isValidTemplate; } 1079 }); 1080 1081 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js 1082 var actions_namespaceObject = {}; 1083 __webpack_require__.r(actions_namespaceObject); 1084 __webpack_require__.d(actions_namespaceObject, { 1085 "__experimentalTearDownEditor": function() { return __experimentalTearDownEditor; }, 1086 "autosave": function() { return autosave; }, 1087 "clearSelectedBlock": function() { return clearSelectedBlock; }, 1088 "createUndoLevel": function() { return createUndoLevel; }, 1089 "disablePublishSidebar": function() { return disablePublishSidebar; }, 1090 "editPost": function() { return editPost; }, 1091 "enablePublishSidebar": function() { return enablePublishSidebar; }, 1092 "enterFormattedText": function() { return enterFormattedText; }, 1093 "exitFormattedText": function() { return exitFormattedText; }, 1094 "hideInsertionPoint": function() { return hideInsertionPoint; }, 1095 "insertBlock": function() { return insertBlock; }, 1096 "insertBlocks": function() { return insertBlocks; }, 1097 "insertDefaultBlock": function() { return insertDefaultBlock; }, 1098 "lockPostAutosaving": function() { return lockPostAutosaving; }, 1099 "lockPostSaving": function() { return lockPostSaving; }, 1100 "mergeBlocks": function() { return mergeBlocks; }, 1101 "moveBlockToPosition": function() { return moveBlockToPosition; }, 1102 "moveBlocksDown": function() { return moveBlocksDown; }, 1103 "moveBlocksUp": function() { return moveBlocksUp; }, 1104 "multiSelect": function() { return multiSelect; }, 1105 "receiveBlocks": function() { return receiveBlocks; }, 1106 "redo": function() { return redo; }, 1107 "refreshPost": function() { return refreshPost; }, 1108 "removeBlock": function() { return removeBlock; }, 1109 "removeBlocks": function() { return removeBlocks; }, 1110 "replaceBlock": function() { return replaceBlock; }, 1111 "replaceBlocks": function() { return replaceBlocks; }, 1112 "resetBlocks": function() { return resetBlocks; }, 1113 "resetEditorBlocks": function() { return resetEditorBlocks; }, 1114 "resetPost": function() { return resetPost; }, 1115 "savePost": function() { return savePost; }, 1116 "selectBlock": function() { return selectBlock; }, 1117 "setTemplateValidity": function() { return setTemplateValidity; }, 1118 "setupEditor": function() { return setupEditor; }, 1119 "setupEditorState": function() { return setupEditorState; }, 1120 "showInsertionPoint": function() { return showInsertionPoint; }, 1121 "startMultiSelect": function() { return startMultiSelect; }, 1122 "startTyping": function() { return startTyping; }, 1123 "stopMultiSelect": function() { return stopMultiSelect; }, 1124 "stopTyping": function() { return stopTyping; }, 1125 "synchronizeTemplate": function() { return synchronizeTemplate; }, 1126 "toggleBlockMode": function() { return toggleBlockMode; }, 1127 "toggleSelection": function() { return toggleSelection; }, 1128 "trashPost": function() { return trashPost; }, 1129 "undo": function() { return undo; }, 1130 "unlockPostAutosaving": function() { return unlockPostAutosaving; }, 1131 "unlockPostSaving": function() { return unlockPostSaving; }, 1132 "updateBlock": function() { return updateBlock; }, 1133 "updateBlockAttributes": function() { return updateBlockAttributes; }, 1134 "updateBlockListSettings": function() { return updateBlockListSettings; }, 1135 "updateEditorSettings": function() { return updateEditorSettings; }, 1136 "updatePost": function() { return updatePost; }, 1137 "updatePostLock": function() { return updatePostLock; } 1138 }); 1139 1140 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 1141 function _extends() { 1142 _extends = Object.assign || function (target) { 1143 for (var i = 1; i < arguments.length; i++) { 1144 var source = arguments[i]; 1145 1146 for (var key in source) { 1147 if (Object.prototype.hasOwnProperty.call(source, key)) { 1148 target[key] = source[key]; 1149 } 1150 } 1151 } 1152 1153 return target; 1154 }; 1155 1156 return _extends.apply(this, arguments); 1157 } 1158 ;// CONCATENATED MODULE: external ["wp","element"] 1159 var external_wp_element_namespaceObject = window["wp"]["element"]; 1160 ;// CONCATENATED MODULE: external "lodash" 1161 var external_lodash_namespaceObject = window["lodash"]; 1162 ;// CONCATENATED MODULE: external ["wp","blocks"] 1163 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 1164 ;// CONCATENATED MODULE: external ["wp","data"] 1165 var external_wp_data_namespaceObject = window["wp"]["data"]; 1166 ;// CONCATENATED MODULE: external ["wp","coreData"] 1167 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 1168 ;// CONCATENATED MODULE: external ["wp","compose"] 1169 var external_wp_compose_namespaceObject = window["wp"]["compose"]; 1170 ;// CONCATENATED MODULE: external ["wp","hooks"] 1171 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1172 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 1173 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 1174 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js 1175 /** 1176 * WordPress dependencies 1177 */ 1178 1179 /** 1180 * The default post editor settings. 1181 * 1182 * @property {boolean|Array} allowedBlockTypes Allowed block types 1183 * @property {boolean} richEditingEnabled Whether rich editing is enabled or not 1184 * @property {boolean} codeEditingEnabled Whether code editing is enabled or not 1185 * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not. 1186 * true = the user has opted to show the Custom Fields panel at the bottom of the editor. 1187 * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. 1188 * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed. 1189 * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API. 1190 * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage. 1191 * @property {Array?} availableTemplates The available post templates 1192 * @property {boolean} disablePostFormats Whether or not the post formats are disabled 1193 * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions 1194 * @property {number} maxUploadFileSize Maximum upload file size 1195 * @property {boolean} supportsLayout Whether the editor supports layouts. 1196 */ 1197 1198 const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, 1199 richEditingEnabled: true, 1200 codeEditingEnabled: true, 1201 enableCustomFields: undefined, 1202 supportsLayout: true 1203 }; 1204 1205 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js 1206 /** 1207 * External dependencies 1208 */ 1209 1210 /** 1211 * WordPress dependencies 1212 */ 1213 1214 1215 /** 1216 * Internal dependencies 1217 */ 1218 1219 1220 /** 1221 * Returns a post attribute value, flattening nested rendered content using its 1222 * raw value in place of its original object form. 1223 * 1224 * @param {*} value Original value. 1225 * 1226 * @return {*} Raw value. 1227 */ 1228 1229 function getPostRawValue(value) { 1230 if (value && 'object' === typeof value && 'raw' in value) { 1231 return value.raw; 1232 } 1233 1234 return value; 1235 } 1236 /** 1237 * Returns true if the two object arguments have the same keys, or false 1238 * otherwise. 1239 * 1240 * @param {Object} a First object. 1241 * @param {Object} b Second object. 1242 * 1243 * @return {boolean} Whether the two objects have the same keys. 1244 */ 1245 1246 function hasSameKeys(a, b) { 1247 return isEqual(keys(a), keys(b)); 1248 } 1249 /** 1250 * Returns true if, given the currently dispatching action and the previously 1251 * dispatched action, the two actions are editing the same post property, or 1252 * false otherwise. 1253 * 1254 * @param {Object} action Currently dispatching action. 1255 * @param {Object} previousAction Previously dispatched action. 1256 * 1257 * @return {boolean} Whether actions are updating the same post property. 1258 */ 1259 1260 function isUpdatingSamePostProperty(action, previousAction) { 1261 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); 1262 } 1263 /** 1264 * Returns true if, given the currently dispatching action and the previously 1265 * dispatched action, the two actions are modifying the same property such that 1266 * undo history should be batched. 1267 * 1268 * @param {Object} action Currently dispatching action. 1269 * @param {Object} previousAction Previously dispatched action. 1270 * 1271 * @return {boolean} Whether to overwrite present state. 1272 */ 1273 1274 function shouldOverwriteState(action, previousAction) { 1275 if (action.type === 'RESET_EDITOR_BLOCKS') { 1276 return !action.shouldCreateUndoLevel; 1277 } 1278 1279 if (!previousAction || action.type !== previousAction.type) { 1280 return false; 1281 } 1282 1283 return isUpdatingSamePostProperty(action, previousAction); 1284 } 1285 function postId() { 1286 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1287 let action = arguments.length > 1 ? arguments[1] : undefined; 1288 1289 switch (action.type) { 1290 case 'SETUP_EDITOR_STATE': 1291 return action.post.id; 1292 } 1293 1294 return state; 1295 } 1296 function postType() { 1297 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1298 let action = arguments.length > 1 ? arguments[1] : undefined; 1299 1300 switch (action.type) { 1301 case 'SETUP_EDITOR_STATE': 1302 return action.post.type; 1303 } 1304 1305 return state; 1306 } 1307 /** 1308 * Reducer returning whether the post blocks match the defined template or not. 1309 * 1310 * @param {Object} state Current state. 1311 * @param {Object} action Dispatched action. 1312 * 1313 * @return {boolean} Updated state. 1314 */ 1315 1316 function template() { 1317 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 1318 isValid: true 1319 }; 1320 let action = arguments.length > 1 ? arguments[1] : undefined; 1321 1322 switch (action.type) { 1323 case 'SET_TEMPLATE_VALIDITY': 1324 return { ...state, 1325 isValid: action.isValid 1326 }; 1327 } 1328 1329 return state; 1330 } 1331 /** 1332 * Reducer returning current network request state (whether a request to 1333 * the WP REST API is in progress, successful, or failed). 1334 * 1335 * @param {Object} state Current state. 1336 * @param {Object} action Dispatched action. 1337 * 1338 * @return {Object} Updated state. 1339 */ 1340 1341 function saving() { 1342 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1343 let action = arguments.length > 1 ? arguments[1] : undefined; 1344 1345 switch (action.type) { 1346 case 'REQUEST_POST_UPDATE_START': 1347 case 'REQUEST_POST_UPDATE_FINISH': 1348 return { 1349 pending: action.type === 'REQUEST_POST_UPDATE_START', 1350 options: action.options || {} 1351 }; 1352 } 1353 1354 return state; 1355 } 1356 /** 1357 * Post Lock State. 1358 * 1359 * @typedef {Object} PostLockState 1360 * 1361 * @property {boolean} isLocked Whether the post is locked. 1362 * @property {?boolean} isTakeover Whether the post editing has been taken over. 1363 * @property {?boolean} activePostLock Active post lock value. 1364 * @property {?Object} user User that took over the post. 1365 */ 1366 1367 /** 1368 * Reducer returning the post lock status. 1369 * 1370 * @param {PostLockState} state Current state. 1371 * @param {Object} action Dispatched action. 1372 * 1373 * @return {PostLockState} Updated state. 1374 */ 1375 1376 function postLock() { 1377 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 1378 isLocked: false 1379 }; 1380 let action = arguments.length > 1 ? arguments[1] : undefined; 1381 1382 switch (action.type) { 1383 case 'UPDATE_POST_LOCK': 1384 return action.lock; 1385 } 1386 1387 return state; 1388 } 1389 /** 1390 * Post saving lock. 1391 * 1392 * When post saving is locked, the post cannot be published or updated. 1393 * 1394 * @param {PostLockState} state Current state. 1395 * @param {Object} action Dispatched action. 1396 * 1397 * @return {PostLockState} Updated state. 1398 */ 1399 1400 function postSavingLock() { 1401 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1402 let action = arguments.length > 1 ? arguments[1] : undefined; 1403 1404 switch (action.type) { 1405 case 'LOCK_POST_SAVING': 1406 return { ...state, 1407 [action.lockName]: true 1408 }; 1409 1410 case 'UNLOCK_POST_SAVING': 1411 return (0,external_lodash_namespaceObject.omit)(state, action.lockName); 1412 } 1413 1414 return state; 1415 } 1416 /** 1417 * Post autosaving lock. 1418 * 1419 * When post autosaving is locked, the post will not autosave. 1420 * 1421 * @param {PostLockState} state Current state. 1422 * @param {Object} action Dispatched action. 1423 * 1424 * @return {PostLockState} Updated state. 1425 */ 1426 1427 function postAutosavingLock() { 1428 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1429 let action = arguments.length > 1 ? arguments[1] : undefined; 1430 1431 switch (action.type) { 1432 case 'LOCK_POST_AUTOSAVING': 1433 return { ...state, 1434 [action.lockName]: true 1435 }; 1436 1437 case 'UNLOCK_POST_AUTOSAVING': 1438 return (0,external_lodash_namespaceObject.omit)(state, action.lockName); 1439 } 1440 1441 return state; 1442 } 1443 /** 1444 * Reducer returning whether the editor is ready to be rendered. 1445 * The editor is considered ready to be rendered once 1446 * the post object is loaded properly and the initial blocks parsed. 1447 * 1448 * @param {boolean} state 1449 * @param {Object} action 1450 * 1451 * @return {boolean} Updated state. 1452 */ 1453 1454 function isReady() { 1455 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 1456 let action = arguments.length > 1 ? arguments[1] : undefined; 1457 1458 switch (action.type) { 1459 case 'SETUP_EDITOR_STATE': 1460 return true; 1461 1462 case 'TEAR_DOWN_EDITOR': 1463 return false; 1464 } 1465 1466 return state; 1467 } 1468 /** 1469 * Reducer returning the post editor setting. 1470 * 1471 * @param {Object} state Current state. 1472 * @param {Object} action Dispatched action. 1473 * 1474 * @return {Object} Updated state. 1475 */ 1476 1477 function editorSettings() { 1478 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS; 1479 let action = arguments.length > 1 ? arguments[1] : undefined; 1480 1481 switch (action.type) { 1482 case 'UPDATE_EDITOR_SETTINGS': 1483 return { ...state, 1484 ...action.settings 1485 }; 1486 } 1487 1488 return state; 1489 } 1490 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 1491 postId, 1492 postType, 1493 saving, 1494 postLock, 1495 template, 1496 postSavingLock, 1497 isReady, 1498 editorSettings, 1499 postAutosavingLock 1500 })); 1501 1502 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js 1503 1504 1505 var LEAF_KEY, hasWeakMap; 1506 1507 /** 1508 * Arbitrary value used as key for referencing cache object in WeakMap tree. 1509 * 1510 * @type {Object} 1511 */ 1512 LEAF_KEY = {}; 1513 1514 /** 1515 * Whether environment supports WeakMap. 1516 * 1517 * @type {boolean} 1518 */ 1519 hasWeakMap = typeof WeakMap !== 'undefined'; 1520 1521 /** 1522 * Returns the first argument as the sole entry in an array. 1523 * 1524 * @param {*} value Value to return. 1525 * 1526 * @return {Array} Value returned as entry in array. 1527 */ 1528 function arrayOf( value ) { 1529 return [ value ]; 1530 } 1531 1532 /** 1533 * Returns true if the value passed is object-like, or false otherwise. A value 1534 * is object-like if it can support property assignment, e.g. object or array. 1535 * 1536 * @param {*} value Value to test. 1537 * 1538 * @return {boolean} Whether value is object-like. 1539 */ 1540 function isObjectLike( value ) { 1541 return !! value && 'object' === typeof value; 1542 } 1543 1544 /** 1545 * Creates and returns a new cache object. 1546 * 1547 * @return {Object} Cache object. 1548 */ 1549 function createCache() { 1550 var cache = { 1551 clear: function() { 1552 cache.head = null; 1553 }, 1554 }; 1555 1556 return cache; 1557 } 1558 1559 /** 1560 * Returns true if entries within the two arrays are strictly equal by 1561 * reference from a starting index. 1562 * 1563 * @param {Array} a First array. 1564 * @param {Array} b Second array. 1565 * @param {number} fromIndex Index from which to start comparison. 1566 * 1567 * @return {boolean} Whether arrays are shallowly equal. 1568 */ 1569 function isShallowEqual( a, b, fromIndex ) { 1570 var i; 1571 1572 if ( a.length !== b.length ) { 1573 return false; 1574 } 1575 1576 for ( i = fromIndex; i < a.length; i++ ) { 1577 if ( a[ i ] !== b[ i ] ) { 1578 return false; 1579 } 1580 } 1581 1582 return true; 1583 } 1584 1585 /** 1586 * Returns a memoized selector function. The getDependants function argument is 1587 * called before the memoized selector and is expected to return an immutable 1588 * reference or array of references on which the selector depends for computing 1589 * its own return value. The memoize cache is preserved only as long as those 1590 * dependant references remain the same. If getDependants returns a different 1591 * reference(s), the cache is cleared and the selector value regenerated. 1592 * 1593 * @param {Function} selector Selector function. 1594 * @param {Function} getDependants Dependant getter returning an immutable 1595 * reference or array of reference used in 1596 * cache bust consideration. 1597 * 1598 * @return {Function} Memoized selector. 1599 */ 1600 /* harmony default export */ function rememo(selector, getDependants ) { 1601 var rootCache, getCache; 1602 1603 // Use object source as dependant if getter not provided 1604 if ( ! getDependants ) { 1605 getDependants = arrayOf; 1606 } 1607 1608 /** 1609 * Returns the root cache. If WeakMap is supported, this is assigned to the 1610 * root WeakMap cache set, otherwise it is a shared instance of the default 1611 * cache object. 1612 * 1613 * @return {(WeakMap|Object)} Root cache object. 1614 */ 1615 function getRootCache() { 1616 return rootCache; 1617 } 1618 1619 /** 1620 * Returns the cache for a given dependants array. When possible, a WeakMap 1621 * will be used to create a unique cache for each set of dependants. This 1622 * is feasible due to the nature of WeakMap in allowing garbage collection 1623 * to occur on entries where the key object is no longer referenced. Since 1624 * WeakMap requires the key to be an object, this is only possible when the 1625 * dependant is object-like. The root cache is created as a hierarchy where 1626 * each top-level key is the first entry in a dependants set, the value a 1627 * WeakMap where each key is the next dependant, and so on. This continues 1628 * so long as the dependants are object-like. If no dependants are object- 1629 * like, then the cache is shared across all invocations. 1630 * 1631 * @see isObjectLike 1632 * 1633 * @param {Array} dependants Selector dependants. 1634 * 1635 * @return {Object} Cache object. 1636 */ 1637 function getWeakMapCache( dependants ) { 1638 var caches = rootCache, 1639 isUniqueByDependants = true, 1640 i, dependant, map, cache; 1641 1642 for ( i = 0; i < dependants.length; i++ ) { 1643 dependant = dependants[ i ]; 1644 1645 // Can only compose WeakMap from object-like key. 1646 if ( ! isObjectLike( dependant ) ) { 1647 isUniqueByDependants = false; 1648 break; 1649 } 1650 1651 // Does current segment of cache already have a WeakMap? 1652 if ( caches.has( dependant ) ) { 1653 // Traverse into nested WeakMap. 1654 caches = caches.get( dependant ); 1655 } else { 1656 // Create, set, and traverse into a new one. 1657 map = new WeakMap(); 1658 caches.set( dependant, map ); 1659 caches = map; 1660 } 1661 } 1662 1663 // We use an arbitrary (but consistent) object as key for the last item 1664 // in the WeakMap to serve as our running cache. 1665 if ( ! caches.has( LEAF_KEY ) ) { 1666 cache = createCache(); 1667 cache.isUniqueByDependants = isUniqueByDependants; 1668 caches.set( LEAF_KEY, cache ); 1669 } 1670 1671 return caches.get( LEAF_KEY ); 1672 } 1673 1674 // Assign cache handler by availability of WeakMap 1675 getCache = hasWeakMap ? getWeakMapCache : getRootCache; 1676 1677 /** 1678 * Resets root memoization cache. 1679 */ 1680 function clear() { 1681 rootCache = hasWeakMap ? new WeakMap() : createCache(); 1682 } 1683 1684 // eslint-disable-next-line jsdoc/check-param-names 1685 /** 1686 * The augmented selector call, considering first whether dependants have 1687 * changed before passing it to underlying memoize function. 1688 * 1689 * @param {Object} source Source object for derivation. 1690 * @param {...*} extraArgs Additional arguments to pass to selector. 1691 * 1692 * @return {*} Selector result. 1693 */ 1694 function callSelector( /* source, ...extraArgs */ ) { 1695 var len = arguments.length, 1696 cache, node, i, args, dependants; 1697 1698 // Create copy of arguments (avoid leaking deoptimization). 1699 args = new Array( len ); 1700 for ( i = 0; i < len; i++ ) { 1701 args[ i ] = arguments[ i ]; 1702 } 1703 1704 dependants = getDependants.apply( null, args ); 1705 cache = getCache( dependants ); 1706 1707 // If not guaranteed uniqueness by dependants (primitive type or lack 1708 // of WeakMap support), shallow compare against last dependants and, if 1709 // references have changed, destroy cache to recalculate result. 1710 if ( ! cache.isUniqueByDependants ) { 1711 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { 1712 cache.clear(); 1713 } 1714 1715 cache.lastDependants = dependants; 1716 } 1717 1718 node = cache.head; 1719 while ( node ) { 1720 // Check whether node arguments match arguments 1721 if ( ! isShallowEqual( node.args, args, 1 ) ) { 1722 node = node.next; 1723 continue; 1724 } 1725 1726 // At this point we can assume we've found a match 1727 1728 // Surface matched node to head if not already 1729 if ( node !== cache.head ) { 1730 // Adjust siblings to point to each other. 1731 node.prev.next = node.next; 1732 if ( node.next ) { 1733 node.next.prev = node.prev; 1734 } 1735 1736 node.next = cache.head; 1737 node.prev = null; 1738 cache.head.prev = node; 1739 cache.head = node; 1740 } 1741 1742 // Return immediately 1743 return node.val; 1744 } 1745 1746 // No cached value found. Continue to insertion phase: 1747 1748 node = { 1749 // Generate the result from original function 1750 val: selector.apply( null, args ), 1751 }; 1752 1753 // Avoid including the source object in the cache. 1754 args[ 0 ] = null; 1755 node.args = args; 1756 1757 // Don't need to check whether node is already head, since it would 1758 // have been returned above already if it was 1759 1760 // Shift existing head down list 1761 if ( cache.head ) { 1762 cache.head.prev = node; 1763 node.next = cache.head; 1764 } 1765 1766 cache.head = node; 1767 1768 return node.val; 1769 } 1770 1771 callSelector.getDependants = getDependants; 1772 callSelector.clear = clear; 1773 clear(); 1774 1775 return callSelector; 1776 } 1777 1778 ;// CONCATENATED MODULE: external ["wp","date"] 1779 var external_wp_date_namespaceObject = window["wp"]["date"]; 1780 ;// CONCATENATED MODULE: external ["wp","url"] 1781 var external_wp_url_namespaceObject = window["wp"]["url"]; 1782 ;// CONCATENATED MODULE: external ["wp","deprecated"] 1783 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 1784 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 1785 ;// CONCATENATED MODULE: external ["wp","primitives"] 1786 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 1787 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 1788 1789 1790 /** 1791 * WordPress dependencies 1792 */ 1793 1794 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1795 xmlns: "http://www.w3.org/2000/svg", 1796 viewBox: "0 0 24 24" 1797 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1798 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" 1799 })); 1800 /* harmony default export */ var library_layout = (layout); 1801 1802 ;// CONCATENATED MODULE: external ["wp","preferences"] 1803 var external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 1804 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js 1805 /** 1806 * Set of post properties for which edits should assume a merging behavior, 1807 * assuming an object value. 1808 * 1809 * @type {Set} 1810 */ 1811 const EDIT_MERGE_PROPERTIES = new Set(['meta']); 1812 /** 1813 * Constant for the store module (or reducer) key. 1814 * 1815 * @type {string} 1816 */ 1817 1818 const STORE_NAME = 'core/editor'; 1819 const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; 1820 const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; 1821 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 1822 const ONE_MINUTE_IN_MS = 60 * 1000; 1823 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; 1824 1825 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js 1826 1827 1828 /** 1829 * WordPress dependencies 1830 */ 1831 1832 const header = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1833 xmlns: "http://www.w3.org/2000/svg", 1834 viewBox: "0 0 24 24" 1835 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1836 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" 1837 })); 1838 /* harmony default export */ var library_header = (header); 1839 1840 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js 1841 1842 1843 /** 1844 * WordPress dependencies 1845 */ 1846 1847 const footer = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1848 xmlns: "http://www.w3.org/2000/svg", 1849 viewBox: "0 0 24 24" 1850 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1851 fillRule: "evenodd", 1852 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" 1853 })); 1854 /* harmony default export */ var library_footer = (footer); 1855 1856 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js 1857 1858 1859 /** 1860 * WordPress dependencies 1861 */ 1862 1863 const sidebar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1864 xmlns: "http://www.w3.org/2000/svg", 1865 viewBox: "0 0 24 24" 1866 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1867 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" 1868 })); 1869 /* harmony default export */ var library_sidebar = (sidebar); 1870 1871 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 1872 1873 1874 /** 1875 * WordPress dependencies 1876 */ 1877 1878 const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1879 xmlns: "http://www.w3.org/2000/svg", 1880 viewBox: "0 0 24 24" 1881 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1882 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" 1883 })); 1884 /* harmony default export */ var symbol_filled = (symbolFilled); 1885 1886 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js 1887 /** 1888 * WordPress dependencies 1889 */ 1890 1891 /** 1892 * Helper function to retrieve the corresponding icon by name. 1893 * 1894 * @param {string} iconName The name of the icon. 1895 * 1896 * @return {Object} The corresponding icon. 1897 */ 1898 1899 function getTemplatePartIcon(iconName) { 1900 if ('header' === iconName) { 1901 return library_header; 1902 } else if ('footer' === iconName) { 1903 return library_footer; 1904 } else if ('sidebar' === iconName) { 1905 return library_sidebar; 1906 } 1907 1908 return symbol_filled; 1909 } 1910 1911 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js 1912 /** 1913 * External dependencies 1914 */ 1915 1916 1917 /** 1918 * WordPress dependencies 1919 */ 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 /** 1932 * Internal dependencies 1933 */ 1934 1935 1936 1937 1938 /** 1939 * Shared reference to an empty object for cases where it is important to avoid 1940 * returning a new object reference on every invocation, as in a connected or 1941 * other pure component which performs `shouldComponentUpdate` check on props. 1942 * This should be used as a last resort, since the normalized data should be 1943 * maintained by the reducer result in state. 1944 */ 1945 1946 const EMPTY_OBJECT = {}; 1947 /** 1948 * Shared reference to an empty array for cases where it is important to avoid 1949 * returning a new array reference on every invocation, as in a connected or 1950 * other pure component which performs `shouldComponentUpdate` check on props. 1951 * This should be used as a last resort, since the normalized data should be 1952 * maintained by the reducer result in state. 1953 */ 1954 1955 const EMPTY_ARRAY = []; 1956 /** 1957 * Returns true if any past editor history snapshots exist, or false otherwise. 1958 * 1959 * @param {Object} state Global application state. 1960 * 1961 * @return {boolean} Whether undo history exists. 1962 */ 1963 1964 const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1965 return select(external_wp_coreData_namespaceObject.store).hasUndo(); 1966 }); 1967 /** 1968 * Returns true if any future editor history snapshots exist, or false 1969 * otherwise. 1970 * 1971 * @param {Object} state Global application state. 1972 * 1973 * @return {boolean} Whether redo history exists. 1974 */ 1975 1976 const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1977 return select(external_wp_coreData_namespaceObject.store).hasRedo(); 1978 }); 1979 /** 1980 * Returns true if the currently edited post is yet to be saved, or false if 1981 * the post has been saved. 1982 * 1983 * @param {Object} state Global application state. 1984 * 1985 * @return {boolean} Whether the post is new. 1986 */ 1987 1988 function isEditedPostNew(state) { 1989 return getCurrentPost(state).status === 'auto-draft'; 1990 } 1991 /** 1992 * Returns true if content includes unsaved changes, or false otherwise. 1993 * 1994 * @param {Object} state Editor state. 1995 * 1996 * @return {boolean} Whether content includes unsaved changes. 1997 */ 1998 1999 function hasChangedContent(state) { 2000 const edits = getPostEdits(state); 2001 return 'blocks' in edits || // `edits` is intended to contain only values which are different from 2002 // the saved post, so the mere presence of a property is an indicator 2003 // that the value is different than what is known to be saved. While 2004 // content in Visual mode is represented by the blocks state, in Text 2005 // mode it is tracked by `edits.content`. 2006 'content' in edits; 2007 } 2008 /** 2009 * Returns true if there are unsaved values for the current edit session, or 2010 * false if the editing state matches the saved or new post. 2011 * 2012 * @param {Object} state Global application state. 2013 * 2014 * @return {boolean} Whether unsaved values exist. 2015 */ 2016 2017 const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2018 // Edits should contain only fields which differ from the saved post (reset 2019 // at initial load and save complete). Thus, a non-empty edits state can be 2020 // inferred to contain unsaved values. 2021 const postType = getCurrentPostType(state); 2022 const postId = getCurrentPostId(state); 2023 2024 if (select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId)) { 2025 return true; 2026 } 2027 2028 return false; 2029 }); 2030 /** 2031 * Returns true if there are unsaved edits for entities other than 2032 * the editor's post, and false otherwise. 2033 * 2034 * @param {Object} state Global application state. 2035 * 2036 * @return {boolean} Whether there are edits or not. 2037 */ 2038 2039 const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2040 const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); 2041 2042 const { 2043 type, 2044 id 2045 } = getCurrentPost(state); 2046 return (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 2047 }); 2048 /** 2049 * Returns true if there are no unsaved values for the current edit session and 2050 * if the currently edited post is new (has never been saved before). 2051 * 2052 * @param {Object} state Global application state. 2053 * 2054 * @return {boolean} Whether new post and unsaved values exist. 2055 */ 2056 2057 function isCleanNewPost(state) { 2058 return !isEditedPostDirty(state) && isEditedPostNew(state); 2059 } 2060 /** 2061 * Returns the post currently being edited in its last known saved state, not 2062 * including unsaved edits. Returns an object containing relevant default post 2063 * values if the post has not yet been saved. 2064 * 2065 * @param {Object} state Global application state. 2066 * 2067 * @return {Object} Post object. 2068 */ 2069 2070 const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2071 const postId = getCurrentPostId(state); 2072 const postType = getCurrentPostType(state); 2073 const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId); 2074 2075 if (post) { 2076 return post; 2077 } // This exists for compatibility with the previous selector behavior 2078 // which would guarantee an object return based on the editor reducer's 2079 // default empty object state. 2080 2081 2082 return EMPTY_OBJECT; 2083 }); 2084 /** 2085 * Returns the post type of the post currently being edited. 2086 * 2087 * @param {Object} state Global application state. 2088 * 2089 * @return {string} Post type. 2090 */ 2091 2092 function getCurrentPostType(state) { 2093 return state.postType; 2094 } 2095 /** 2096 * Returns the ID of the post currently being edited, or null if the post has 2097 * not yet been saved. 2098 * 2099 * @param {Object} state Global application state. 2100 * 2101 * @return {?number} ID of current post. 2102 */ 2103 2104 function getCurrentPostId(state) { 2105 return state.postId; 2106 } 2107 /** 2108 * Returns the number of revisions of the post currently being edited. 2109 * 2110 * @param {Object} state Global application state. 2111 * 2112 * @return {number} Number of revisions. 2113 */ 2114 2115 function getCurrentPostRevisionsCount(state) { 2116 return (0,external_lodash_namespaceObject.get)(getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); 2117 } 2118 /** 2119 * Returns the last revision ID of the post currently being edited, 2120 * or null if the post has no revisions. 2121 * 2122 * @param {Object} state Global application state. 2123 * 2124 * @return {?number} ID of the last revision. 2125 */ 2126 2127 function getCurrentPostLastRevisionId(state) { 2128 return (0,external_lodash_namespaceObject.get)(getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); 2129 } 2130 /** 2131 * Returns any post values which have been changed in the editor but not yet 2132 * been saved. 2133 * 2134 * @param {Object} state Global application state. 2135 * 2136 * @return {Object} Object of key value pairs comprising unsaved edits. 2137 */ 2138 2139 const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2140 const postType = getCurrentPostType(state); 2141 const postId = getCurrentPostId(state); 2142 return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; 2143 }); 2144 /** 2145 * Returns an attribute value of the saved post. 2146 * 2147 * @param {Object} state Global application state. 2148 * @param {string} attributeName Post attribute name. 2149 * 2150 * @return {*} Post attribute value. 2151 */ 2152 2153 function getCurrentPostAttribute(state, attributeName) { 2154 switch (attributeName) { 2155 case 'type': 2156 return getCurrentPostType(state); 2157 2158 case 'id': 2159 return getCurrentPostId(state); 2160 2161 default: 2162 const post = getCurrentPost(state); 2163 2164 if (!post.hasOwnProperty(attributeName)) { 2165 break; 2166 } 2167 2168 return getPostRawValue(post[attributeName]); 2169 } 2170 } 2171 /** 2172 * Returns a single attribute of the post being edited, preferring the unsaved 2173 * edit if one exists, but merging with the attribute value for the last known 2174 * saved state of the post (this is needed for some nested attributes like meta). 2175 * 2176 * @param {Object} state Global application state. 2177 * @param {string} attributeName Post attribute name. 2178 * 2179 * @return {*} Post attribute value. 2180 */ 2181 2182 const getNestedEditedPostProperty = (state, attributeName) => { 2183 const edits = getPostEdits(state); 2184 2185 if (!edits.hasOwnProperty(attributeName)) { 2186 return getCurrentPostAttribute(state, attributeName); 2187 } 2188 2189 return { ...getCurrentPostAttribute(state, attributeName), 2190 ...edits[attributeName] 2191 }; 2192 }; 2193 /** 2194 * Returns a single attribute of the post being edited, preferring the unsaved 2195 * edit if one exists, but falling back to the attribute for the last known 2196 * saved state of the post. 2197 * 2198 * @param {Object} state Global application state. 2199 * @param {string} attributeName Post attribute name. 2200 * 2201 * @return {*} Post attribute value. 2202 */ 2203 2204 2205 function getEditedPostAttribute(state, attributeName) { 2206 // Special cases. 2207 switch (attributeName) { 2208 case 'content': 2209 return getEditedPostContent(state); 2210 } // Fall back to saved post value if not edited. 2211 2212 2213 const edits = getPostEdits(state); 2214 2215 if (!edits.hasOwnProperty(attributeName)) { 2216 return getCurrentPostAttribute(state, attributeName); 2217 } // Merge properties are objects which contain only the patch edit in state, 2218 // and thus must be merged with the current post attribute. 2219 2220 2221 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 2222 return getNestedEditedPostProperty(state, attributeName); 2223 } 2224 2225 return edits[attributeName]; 2226 } 2227 /** 2228 * Returns an attribute value of the current autosave revision for a post, or 2229 * null if there is no autosave for the post. 2230 * 2231 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector 2232 * from the '@wordpress/core-data' package and access properties on the returned 2233 * autosave object using getPostRawValue. 2234 * 2235 * @param {Object} state Global application state. 2236 * @param {string} attributeName Autosave attribute name. 2237 * 2238 * @return {*} Autosave attribute value. 2239 */ 2240 2241 const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => { 2242 if (!(0,external_lodash_namespaceObject.includes)(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') { 2243 return; 2244 } 2245 2246 const postType = getCurrentPostType(state); 2247 const postId = getCurrentPostId(state); 2248 const currentUserId = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getCurrentUser(), ['id']); 2249 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 2250 2251 if (autosave) { 2252 return getPostRawValue(autosave[attributeName]); 2253 } 2254 }); 2255 /** 2256 * Returns the current visibility of the post being edited, preferring the 2257 * unsaved value if different than the saved post. The return value is one of 2258 * "private", "password", or "public". 2259 * 2260 * @param {Object} state Global application state. 2261 * 2262 * @return {string} Post visibility. 2263 */ 2264 2265 function getEditedPostVisibility(state) { 2266 const status = getEditedPostAttribute(state, 'status'); 2267 2268 if (status === 'private') { 2269 return 'private'; 2270 } 2271 2272 const password = getEditedPostAttribute(state, 'password'); 2273 2274 if (password) { 2275 return 'password'; 2276 } 2277 2278 return 'public'; 2279 } 2280 /** 2281 * Returns true if post is pending review. 2282 * 2283 * @param {Object} state Global application state. 2284 * 2285 * @return {boolean} Whether current post is pending review. 2286 */ 2287 2288 function isCurrentPostPending(state) { 2289 return getCurrentPost(state).status === 'pending'; 2290 } 2291 /** 2292 * Return true if the current post has already been published. 2293 * 2294 * @param {Object} state Global application state. 2295 * @param {Object?} currentPost Explicit current post for bypassing registry selector. 2296 * 2297 * @return {boolean} Whether the post has been published. 2298 */ 2299 2300 function isCurrentPostPublished(state, currentPost) { 2301 const post = currentPost || getCurrentPost(state); 2302 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS)); 2303 } 2304 /** 2305 * Returns true if post is already scheduled. 2306 * 2307 * @param {Object} state Global application state. 2308 * 2309 * @return {boolean} Whether current post is scheduled to be posted. 2310 */ 2311 2312 function isCurrentPostScheduled(state) { 2313 return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state); 2314 } 2315 /** 2316 * Return true if the post being edited can be published. 2317 * 2318 * @param {Object} state Global application state. 2319 * 2320 * @return {boolean} Whether the post can been published. 2321 */ 2322 2323 function isEditedPostPublishable(state) { 2324 const post = getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post 2325 // being saveable. Currently this restriction is imposed at UI. 2326 // 2327 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`). 2328 2329 return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; 2330 } 2331 /** 2332 * Returns true if the post can be saved, or false otherwise. A post must 2333 * contain a title, an excerpt, or non-empty content to be valid for save. 2334 * 2335 * @param {Object} state Global application state. 2336 * 2337 * @return {boolean} Whether the post can be saved. 2338 */ 2339 2340 function isEditedPostSaveable(state) { 2341 if (isSavingPost(state)) { 2342 return false; 2343 } // TODO: Post should not be saveable if not dirty. Cannot be added here at 2344 // this time since posts where meta boxes are present can be saved even if 2345 // the post is not dirty. Currently this restriction is imposed at UI, but 2346 // should be moved here. 2347 // 2348 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) 2349 // See: <PostSavedState /> (`forceIsDirty` prop) 2350 // See: <PostPublishButton /> (`forceIsDirty` prop) 2351 // See: https://github.com/WordPress/gutenberg/pull/4184. 2352 2353 2354 return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native'; 2355 } 2356 /** 2357 * Returns true if the edited post has content. A post has content if it has at 2358 * least one saveable block or otherwise has a non-empty content property 2359 * assigned. 2360 * 2361 * @param {Object} state Global application state. 2362 * 2363 * @return {boolean} Whether post has content. 2364 */ 2365 2366 function isEditedPostEmpty(state) { 2367 // While the condition of truthy content string is sufficient to determine 2368 // emptiness, testing saveable blocks length is a trivial operation. Since 2369 // this function can be called frequently, optimize for the fast case as a 2370 // condition of the mere existence of blocks. Note that the value of edited 2371 // content takes precedent over block content, and must fall through to the 2372 // default logic. 2373 const blocks = getEditorBlocks(state); 2374 2375 if (blocks.length) { 2376 // Pierce the abstraction of the serializer in knowing that blocks are 2377 // joined with with newlines such that even if every individual block 2378 // produces an empty save result, the serialized content is non-empty. 2379 if (blocks.length > 1) { 2380 return false; 2381 } // There are two conditions under which the optimization cannot be 2382 // assumed, and a fallthrough to getEditedPostContent must occur: 2383 // 2384 // 1. getBlocksForSerialization has special treatment in omitting a 2385 // single unmodified default block. 2386 // 2. Comment delimiters are omitted for a freeform or unregistered 2387 // block in its serialization. The freeform block specifically may 2388 // produce an empty string in its saved output. 2389 // 2390 // For all other content, the single block is assumed to make a post 2391 // non-empty, if only by virtue of its own comment delimiters. 2392 2393 2394 const blockName = blocks[0].name; 2395 2396 if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { 2397 return false; 2398 } 2399 } 2400 2401 return !getEditedPostContent(state); 2402 } 2403 /** 2404 * Returns true if the post can be autosaved, or false otherwise. 2405 * 2406 * @param {Object} state Global application state. 2407 * @param {Object} autosave A raw autosave object from the REST API. 2408 * 2409 * @return {boolean} Whether the post can be autosaved. 2410 */ 2411 2412 const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2413 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. 2414 if (!isEditedPostSaveable(state)) { 2415 return false; 2416 } // A post is not autosavable when there is a post autosave lock. 2417 2418 2419 if (isPostAutosavingLocked(state)) { 2420 return false; 2421 } 2422 2423 const postType = getCurrentPostType(state); 2424 const postId = getCurrentPostId(state); 2425 const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId); 2426 const currentUserId = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave 2427 // via a resolver, moving below the return would result in the autosave never 2428 // being fetched. 2429 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 2430 2431 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is 2432 // unable to determine if the post is autosaveable, so return false. 2433 2434 if (!hasFetchedAutosave) { 2435 return false; 2436 } // If we don't already have an autosave, the post is autosaveable. 2437 2438 2439 if (!autosave) { 2440 return true; 2441 } // To avoid an expensive content serialization, use the content dirtiness 2442 // flag in place of content field comparison against the known autosave. 2443 // This is not strictly accurate, and relies on a tolerance toward autosave 2444 // request failures for unnecessary saves. 2445 2446 2447 if (hasChangedContent(state)) { 2448 return true; 2449 } // If the title or excerpt has changed, the post is autosaveable. 2450 2451 2452 return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); 2453 }); 2454 /** 2455 * Return true if the post being edited is being scheduled. Preferring the 2456 * unsaved status values. 2457 * 2458 * @param {Object} state Global application state. 2459 * 2460 * @return {boolean} Whether the post has been published. 2461 */ 2462 2463 function isEditedPostBeingScheduled(state) { 2464 const date = getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency). 2465 2466 const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS); 2467 return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); 2468 } 2469 /** 2470 * Returns whether the current post should be considered to have a "floating" 2471 * date (i.e. that it would publish "Immediately" rather than at a set time). 2472 * 2473 * Unlike in the PHP backend, the REST API returns a full date string for posts 2474 * where the 0000-00-00T00:00:00 placeholder is present in the database. To 2475 * infer that a post is set to publish "Immediately" we check whether the date 2476 * and modified date are the same. 2477 * 2478 * @param {Object} state Editor state. 2479 * 2480 * @return {boolean} Whether the edited post has a floating date value. 2481 */ 2482 2483 function isEditedPostDateFloating(state) { 2484 const date = getEditedPostAttribute(state, 'date'); 2485 const modified = getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post 2486 // It shouldn't use the "edited" status otherwise it breaks the 2487 // inferred post data floating status 2488 // See https://github.com/WordPress/gutenberg/issues/28083. 2489 2490 const status = getCurrentPost(state).status; 2491 2492 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { 2493 return date === modified || date === null; 2494 } 2495 2496 return false; 2497 } 2498 /** 2499 * Returns true if the post is currently being saved, or false otherwise. 2500 * 2501 * @param {Object} state Global application state. 2502 * 2503 * @return {boolean} Whether post is being saved. 2504 */ 2505 2506 const isSavingPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2507 const postType = getCurrentPostType(state); 2508 const postId = getCurrentPostId(state); 2509 return select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('postType', postType, postId); 2510 }); 2511 /** 2512 * Returns true if non-post entities are currently being saved, or false otherwise. 2513 * 2514 * @param {Object} state Global application state. 2515 * 2516 * @return {boolean} Whether non-post entities are being saved. 2517 */ 2518 2519 const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2520 const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); 2521 2522 const { 2523 type, 2524 id 2525 } = getCurrentPost(state); 2526 return (0,external_lodash_namespaceObject.some)(entitiesBeingSaved, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 2527 }); 2528 /** 2529 * Returns true if a previous post save was attempted successfully, or false 2530 * otherwise. 2531 * 2532 * @param {Object} state Global application state. 2533 * 2534 * @return {boolean} Whether the post was saved successfully. 2535 */ 2536 2537 const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2538 const postType = getCurrentPostType(state); 2539 const postId = getCurrentPostId(state); 2540 return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 2541 }); 2542 /** 2543 * Returns true if a previous post save was attempted but failed, or false 2544 * otherwise. 2545 * 2546 * @param {Object} state Global application state. 2547 * 2548 * @return {boolean} Whether the post save failed. 2549 */ 2550 2551 const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2552 const postType = getCurrentPostType(state); 2553 const postId = getCurrentPostId(state); 2554 return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 2555 }); 2556 /** 2557 * Returns true if the post is autosaving, or false otherwise. 2558 * 2559 * @param {Object} state Global application state. 2560 * 2561 * @return {boolean} Whether the post is autosaving. 2562 */ 2563 2564 function isAutosavingPost(state) { 2565 if (!isSavingPost(state)) { 2566 return false; 2567 } 2568 2569 return !!(0,external_lodash_namespaceObject.get)(state.saving, ['options', 'isAutosave']); 2570 } 2571 /** 2572 * Returns true if the post is being previewed, or false otherwise. 2573 * 2574 * @param {Object} state Global application state. 2575 * 2576 * @return {boolean} Whether the post is being previewed. 2577 */ 2578 2579 function isPreviewingPost(state) { 2580 if (!isSavingPost(state)) { 2581 return false; 2582 } 2583 2584 return !!(0,external_lodash_namespaceObject.get)(state.saving, ['options', 'isPreview']); 2585 } 2586 /** 2587 * Returns the post preview link 2588 * 2589 * @param {Object} state Global application state. 2590 * 2591 * @return {string?} Preview Link. 2592 */ 2593 2594 function getEditedPostPreviewLink(state) { 2595 if (state.saving.pending || isSavingPost(state)) { 2596 return; 2597 } 2598 2599 let previewLink = getAutosaveAttribute(state, 'preview_link'); // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616 2600 // If the post is draft, ignore the preview link from the autosave record, 2601 // because the preview could be a stale autosave if the post was switched from 2602 // published to draft. 2603 // See: https://github.com/WordPress/gutenberg/pull/37952. 2604 2605 if (!previewLink || 'draft' === getCurrentPost(state).status) { 2606 previewLink = getEditedPostAttribute(state, 'link'); 2607 2608 if (previewLink) { 2609 previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 2610 preview: true 2611 }); 2612 } 2613 } 2614 2615 const featuredImageId = getEditedPostAttribute(state, 'featured_media'); 2616 2617 if (previewLink && featuredImageId) { 2618 return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 2619 _thumbnail_id: featuredImageId 2620 }); 2621 } 2622 2623 return previewLink; 2624 } 2625 /** 2626 * Returns a suggested post format for the current post, inferred only if there 2627 * is a single block within the post and it is of a type known to match a 2628 * default post format. Returns null if the format cannot be determined. 2629 * 2630 * @param {Object} state Global application state. 2631 * 2632 * @return {?string} Suggested post format. 2633 */ 2634 2635 function getSuggestedPostFormat(state) { 2636 const blocks = getEditorBlocks(state); 2637 if (blocks.length > 2) return null; 2638 let name; // If there is only one block in the content of the post grab its name 2639 // so we can derive a suitable post format from it. 2640 2641 if (blocks.length === 1) { 2642 name = blocks[0].name; // Check for core/embed `video` and `audio` eligible suggestions. 2643 2644 if (name === 'core/embed') { 2645 var _blocks$0$attributes; 2646 2647 const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug; 2648 2649 if (['youtube', 'vimeo'].includes(provider)) { 2650 name = 'core/video'; 2651 } else if (['spotify', 'soundcloud'].includes(provider)) { 2652 name = 'core/audio'; 2653 } 2654 } 2655 } // If there are two blocks in the content and the last one is a text blocks 2656 // grab the name of the first one to also suggest a post format from it. 2657 2658 2659 if (blocks.length === 2 && blocks[1].name === 'core/paragraph') { 2660 name = blocks[0].name; 2661 } // We only convert to default post formats in core. 2662 2663 2664 switch (name) { 2665 case 'core/image': 2666 return 'image'; 2667 2668 case 'core/quote': 2669 case 'core/pullquote': 2670 return 'quote'; 2671 2672 case 'core/gallery': 2673 return 'gallery'; 2674 2675 case 'core/video': 2676 return 'video'; 2677 2678 case 'core/audio': 2679 return 'audio'; 2680 2681 default: 2682 return null; 2683 } 2684 } 2685 /** 2686 * Returns the content of the post being edited. 2687 * 2688 * @param {Object} state Global application state. 2689 * 2690 * @return {string} Post content. 2691 */ 2692 2693 const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2694 const postId = getCurrentPostId(state); 2695 const postType = getCurrentPostType(state); 2696 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 2697 2698 if (record) { 2699 if (typeof record.content === 'function') { 2700 return record.content(record); 2701 } else if (record.blocks) { 2702 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 2703 } else if (record.content) { 2704 return record.content; 2705 } 2706 } 2707 2708 return ''; 2709 }); 2710 /** 2711 * Returns true if the post is being published, or false otherwise. 2712 * 2713 * @param {Object} state Global application state. 2714 * 2715 * @return {boolean} Whether post is being published. 2716 */ 2717 2718 function isPublishingPost(state) { 2719 return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish'; 2720 } 2721 /** 2722 * Returns whether the permalink is editable or not. 2723 * 2724 * @param {Object} state Editor state. 2725 * 2726 * @return {boolean} Whether or not the permalink is editable. 2727 */ 2728 2729 function isPermalinkEditable(state) { 2730 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 2731 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 2732 } 2733 /** 2734 * Returns the permalink for the post. 2735 * 2736 * @param {Object} state Editor state. 2737 * 2738 * @return {?string} The permalink, or null if the post is not viewable. 2739 */ 2740 2741 function getPermalink(state) { 2742 const permalinkParts = getPermalinkParts(state); 2743 2744 if (!permalinkParts) { 2745 return null; 2746 } 2747 2748 const { 2749 prefix, 2750 postName, 2751 suffix 2752 } = permalinkParts; 2753 2754 if (isPermalinkEditable(state)) { 2755 return prefix + postName + suffix; 2756 } 2757 2758 return prefix; 2759 } 2760 /** 2761 * Returns the slug for the post being edited, preferring a manually edited 2762 * value if one exists, then a sanitized version of the current post title, and 2763 * finally the post ID. 2764 * 2765 * @param {Object} state Editor state. 2766 * 2767 * @return {string} The current slug to be displayed in the editor 2768 */ 2769 2770 function getEditedPostSlug(state) { 2771 return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state); 2772 } 2773 /** 2774 * Returns the permalink for a post, split into it's three parts: the prefix, 2775 * the postName, and the suffix. 2776 * 2777 * @param {Object} state Editor state. 2778 * 2779 * @return {Object} An object containing the prefix, postName, and suffix for 2780 * the permalink, or null if the post is not viewable. 2781 */ 2782 2783 function getPermalinkParts(state) { 2784 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 2785 2786 if (!permalinkTemplate) { 2787 return null; 2788 } 2789 2790 const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug'); 2791 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); 2792 return { 2793 prefix, 2794 postName, 2795 suffix 2796 }; 2797 } 2798 /** 2799 * Returns whether the post is locked. 2800 * 2801 * @param {Object} state Global application state. 2802 * 2803 * @return {boolean} Is locked. 2804 */ 2805 2806 function isPostLocked(state) { 2807 return state.postLock.isLocked; 2808 } 2809 /** 2810 * Returns whether post saving is locked. 2811 * 2812 * @param {Object} state Global application state. 2813 * 2814 * @return {boolean} Is locked. 2815 */ 2816 2817 function isPostSavingLocked(state) { 2818 return Object.keys(state.postSavingLock).length > 0; 2819 } 2820 /** 2821 * Returns whether post autosaving is locked. 2822 * 2823 * @param {Object} state Global application state. 2824 * 2825 * @return {boolean} Is locked. 2826 */ 2827 2828 function isPostAutosavingLocked(state) { 2829 return Object.keys(state.postAutosavingLock).length > 0; 2830 } 2831 /** 2832 * Returns whether the edition of the post has been taken over. 2833 * 2834 * @param {Object} state Global application state. 2835 * 2836 * @return {boolean} Is post lock takeover. 2837 */ 2838 2839 function isPostLockTakeover(state) { 2840 return state.postLock.isTakeover; 2841 } 2842 /** 2843 * Returns details about the post lock user. 2844 * 2845 * @param {Object} state Global application state. 2846 * 2847 * @return {Object} A user object. 2848 */ 2849 2850 function getPostLockUser(state) { 2851 return state.postLock.user; 2852 } 2853 /** 2854 * Returns the active post lock. 2855 * 2856 * @param {Object} state Global application state. 2857 * 2858 * @return {Object} The lock object. 2859 */ 2860 2861 function getActivePostLock(state) { 2862 return state.postLock.activePostLock; 2863 } 2864 /** 2865 * Returns whether or not the user has the unfiltered_html capability. 2866 * 2867 * @param {Object} state Editor state. 2868 * 2869 * @return {boolean} Whether the user can or can't post unfiltered HTML. 2870 */ 2871 2872 function canUserUseUnfilteredHTML(state) { 2873 return (0,external_lodash_namespaceObject.has)(getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); 2874 } 2875 /** 2876 * Returns whether the pre-publish panel should be shown 2877 * or skipped when the user clicks the "publish" button. 2878 * 2879 * @return {boolean} Whether the pre-publish panel should be shown or not. 2880 */ 2881 2882 const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'isPublishSidebarEnabled')); 2883 /** 2884 * Return the current block list. 2885 * 2886 * @param {Object} state 2887 * @return {Array} Block list. 2888 */ 2889 2890 function getEditorBlocks(state) { 2891 return getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY; 2892 } 2893 /** 2894 * A block selection object. 2895 * 2896 * @typedef {Object} WPBlockSelection 2897 * 2898 * @property {string} clientId A block client ID. 2899 * @property {string} attributeKey A block attribute key. 2900 * @property {number} offset An attribute value offset, based on the rich 2901 * text value. See `wp.richText.create`. 2902 */ 2903 2904 /** 2905 * Returns the current selection start. 2906 * 2907 * @param {Object} state 2908 * @return {WPBlockSelection} The selection start. 2909 * 2910 * @deprecated since Gutenberg 10.0.0. 2911 */ 2912 2913 function getEditorSelectionStart(state) { 2914 var _getEditedPostAttribu; 2915 2916 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 2917 since: '5.8', 2918 alternative: "select('core/editor').getEditorSelection" 2919 }); 2920 return (_getEditedPostAttribu = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart; 2921 } 2922 /** 2923 * Returns the current selection end. 2924 * 2925 * @param {Object} state 2926 * @return {WPBlockSelection} The selection end. 2927 * 2928 * @deprecated since Gutenberg 10.0.0. 2929 */ 2930 2931 function getEditorSelectionEnd(state) { 2932 var _getEditedPostAttribu2; 2933 2934 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 2935 since: '5.8', 2936 alternative: "select('core/editor').getEditorSelection" 2937 }); 2938 return (_getEditedPostAttribu2 = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd; 2939 } 2940 /** 2941 * Returns the current selection. 2942 * 2943 * @param {Object} state 2944 * @return {WPBlockSelection} The selection end. 2945 */ 2946 2947 function getEditorSelection(state) { 2948 return getEditedPostAttribute(state, 'selection'); 2949 } 2950 /** 2951 * Is the editor ready 2952 * 2953 * @param {Object} state 2954 * @return {boolean} is Ready. 2955 */ 2956 2957 function __unstableIsEditorReady(state) { 2958 return state.isReady; 2959 } 2960 /** 2961 * Returns the post editor settings. 2962 * 2963 * @param {Object} state Editor state. 2964 * 2965 * @return {Object} The editor settings object. 2966 */ 2967 2968 function getEditorSettings(state) { 2969 return state.editorSettings; 2970 } 2971 /* 2972 * Backward compatibility 2973 */ 2974 2975 /** 2976 * Returns state object prior to a specified optimist transaction ID, or `null` 2977 * if the transaction corresponding to the given ID cannot be found. 2978 * 2979 * @deprecated since Gutenberg 9.7.0. 2980 */ 2981 2982 function getStateBeforeOptimisticTransaction() { 2983 external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { 2984 since: '5.7', 2985 hint: 'No state history is kept on this store anymore' 2986 }); 2987 return null; 2988 } 2989 /** 2990 * Returns true if an optimistic transaction is pending commit, for which the 2991 * before state satisfies the given predicate function. 2992 * 2993 * @deprecated since Gutenberg 9.7.0. 2994 */ 2995 2996 function inSomeHistory() { 2997 external_wp_deprecated_default()("select('core/editor').inSomeHistory", { 2998 since: '5.7', 2999 hint: 'No state history is kept on this store anymore' 3000 }); 3001 return false; 3002 } 3003 3004 function getBlockEditorSelector(name) { 3005 return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => function (state) { 3006 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { 3007 since: '5.3', 3008 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`', 3009 version: '6.2' 3010 }); 3011 3012 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 3013 args[_key - 1] = arguments[_key]; 3014 } 3015 3016 return select(external_wp_blockEditor_namespaceObject.store)[name](...args); 3017 }); 3018 } 3019 /** 3020 * @see getBlockName in core/block-editor store. 3021 */ 3022 3023 3024 const getBlockName = getBlockEditorSelector('getBlockName'); 3025 /** 3026 * @see isBlockValid in core/block-editor store. 3027 */ 3028 3029 const isBlockValid = getBlockEditorSelector('isBlockValid'); 3030 /** 3031 * @see getBlockAttributes in core/block-editor store. 3032 */ 3033 3034 const getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); 3035 /** 3036 * @see getBlock in core/block-editor store. 3037 */ 3038 3039 const getBlock = getBlockEditorSelector('getBlock'); 3040 /** 3041 * @see getBlocks in core/block-editor store. 3042 */ 3043 3044 const getBlocks = getBlockEditorSelector('getBlocks'); 3045 /** 3046 * @see getClientIdsOfDescendants in core/block-editor store. 3047 */ 3048 3049 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); 3050 /** 3051 * @see getClientIdsWithDescendants in core/block-editor store. 3052 */ 3053 3054 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); 3055 /** 3056 * @see getGlobalBlockCount in core/block-editor store. 3057 */ 3058 3059 const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); 3060 /** 3061 * @see getBlocksByClientId in core/block-editor store. 3062 */ 3063 3064 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); 3065 /** 3066 * @see getBlockCount in core/block-editor store. 3067 */ 3068 3069 const getBlockCount = getBlockEditorSelector('getBlockCount'); 3070 /** 3071 * @see getBlockSelectionStart in core/block-editor store. 3072 */ 3073 3074 const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); 3075 /** 3076 * @see getBlockSelectionEnd in core/block-editor store. 3077 */ 3078 3079 const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); 3080 /** 3081 * @see getSelectedBlockCount in core/block-editor store. 3082 */ 3083 3084 const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); 3085 /** 3086 * @see hasSelectedBlock in core/block-editor store. 3087 */ 3088 3089 const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); 3090 /** 3091 * @see getSelectedBlockClientId in core/block-editor store. 3092 */ 3093 3094 const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); 3095 /** 3096 * @see getSelectedBlock in core/block-editor store. 3097 */ 3098 3099 const getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); 3100 /** 3101 * @see getBlockRootClientId in core/block-editor store. 3102 */ 3103 3104 const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); 3105 /** 3106 * @see getBlockHierarchyRootClientId in core/block-editor store. 3107 */ 3108 3109 const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); 3110 /** 3111 * @see getAdjacentBlockClientId in core/block-editor store. 3112 */ 3113 3114 const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); 3115 /** 3116 * @see getPreviousBlockClientId in core/block-editor store. 3117 */ 3118 3119 const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); 3120 /** 3121 * @see getNextBlockClientId in core/block-editor store. 3122 */ 3123 3124 const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); 3125 /** 3126 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. 3127 */ 3128 3129 const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); 3130 /** 3131 * @see getMultiSelectedBlockClientIds in core/block-editor store. 3132 */ 3133 3134 const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); 3135 /** 3136 * @see getMultiSelectedBlocks in core/block-editor store. 3137 */ 3138 3139 const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); 3140 /** 3141 * @see getFirstMultiSelectedBlockClientId in core/block-editor store. 3142 */ 3143 3144 const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); 3145 /** 3146 * @see getLastMultiSelectedBlockClientId in core/block-editor store. 3147 */ 3148 3149 const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); 3150 /** 3151 * @see isFirstMultiSelectedBlock in core/block-editor store. 3152 */ 3153 3154 const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); 3155 /** 3156 * @see isBlockMultiSelected in core/block-editor store. 3157 */ 3158 3159 const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); 3160 /** 3161 * @see isAncestorMultiSelected in core/block-editor store. 3162 */ 3163 3164 const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); 3165 /** 3166 * @see getMultiSelectedBlocksStartClientId in core/block-editor store. 3167 */ 3168 3169 const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); 3170 /** 3171 * @see getMultiSelectedBlocksEndClientId in core/block-editor store. 3172 */ 3173 3174 const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); 3175 /** 3176 * @see getBlockOrder in core/block-editor store. 3177 */ 3178 3179 const getBlockOrder = getBlockEditorSelector('getBlockOrder'); 3180 /** 3181 * @see getBlockIndex in core/block-editor store. 3182 */ 3183 3184 const getBlockIndex = getBlockEditorSelector('getBlockIndex'); 3185 /** 3186 * @see isBlockSelected in core/block-editor store. 3187 */ 3188 3189 const isBlockSelected = getBlockEditorSelector('isBlockSelected'); 3190 /** 3191 * @see hasSelectedInnerBlock in core/block-editor store. 3192 */ 3193 3194 const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); 3195 /** 3196 * @see isBlockWithinSelection in core/block-editor store. 3197 */ 3198 3199 const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); 3200 /** 3201 * @see hasMultiSelection in core/block-editor store. 3202 */ 3203 3204 const hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); 3205 /** 3206 * @see isMultiSelecting in core/block-editor store. 3207 */ 3208 3209 const isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); 3210 /** 3211 * @see isSelectionEnabled in core/block-editor store. 3212 */ 3213 3214 const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); 3215 /** 3216 * @see getBlockMode in core/block-editor store. 3217 */ 3218 3219 const getBlockMode = getBlockEditorSelector('getBlockMode'); 3220 /** 3221 * @see isTyping in core/block-editor store. 3222 */ 3223 3224 const isTyping = getBlockEditorSelector('isTyping'); 3225 /** 3226 * @see isCaretWithinFormattedText in core/block-editor store. 3227 */ 3228 3229 const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); 3230 /** 3231 * @see getBlockInsertionPoint in core/block-editor store. 3232 */ 3233 3234 const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); 3235 /** 3236 * @see isBlockInsertionPointVisible in core/block-editor store. 3237 */ 3238 3239 const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); 3240 /** 3241 * @see isValidTemplate in core/block-editor store. 3242 */ 3243 3244 const isValidTemplate = getBlockEditorSelector('isValidTemplate'); 3245 /** 3246 * @see getTemplate in core/block-editor store. 3247 */ 3248 3249 const getTemplate = getBlockEditorSelector('getTemplate'); 3250 /** 3251 * @see getTemplateLock in core/block-editor store. 3252 */ 3253 3254 const getTemplateLock = getBlockEditorSelector('getTemplateLock'); 3255 /** 3256 * @see canInsertBlockType in core/block-editor store. 3257 */ 3258 3259 const canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); 3260 /** 3261 * @see getInserterItems in core/block-editor store. 3262 */ 3263 3264 const getInserterItems = getBlockEditorSelector('getInserterItems'); 3265 /** 3266 * @see hasInserterItems in core/block-editor store. 3267 */ 3268 3269 const hasInserterItems = getBlockEditorSelector('hasInserterItems'); 3270 /** 3271 * @see getBlockListSettings in core/block-editor store. 3272 */ 3273 3274 const getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); 3275 /** 3276 * Returns the default template types. 3277 * 3278 * @param {Object} state Global application state. 3279 * 3280 * @return {Object} The template types. 3281 */ 3282 3283 function __experimentalGetDefaultTemplateTypes(state) { 3284 var _getEditorSettings; 3285 3286 return (_getEditorSettings = getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes; 3287 } 3288 /** 3289 * Returns the default template part areas. 3290 * 3291 * @param {Object} state Global application state. 3292 * 3293 * @return {Array} The template part areas. 3294 */ 3295 3296 const __experimentalGetDefaultTemplatePartAreas = rememo(state => { 3297 var _getEditorSettings2; 3298 3299 const areas = ((_getEditorSettings2 = getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || []; 3300 return areas === null || areas === void 0 ? void 0 : areas.map(item => { 3301 return { ...item, 3302 icon: getTemplatePartIcon(item.icon) 3303 }; 3304 }); 3305 }, state => { 3306 var _getEditorSettings3; 3307 3308 return [(_getEditorSettings3 = getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas]; 3309 }); 3310 /** 3311 * Returns a default template type searched by slug. 3312 * 3313 * @param {Object} state Global application state. 3314 * @param {string} slug The template type slug. 3315 * 3316 * @return {Object} The template type. 3317 */ 3318 3319 const __experimentalGetDefaultTemplateType = rememo((state, slug) => (0,external_lodash_namespaceObject.find)(__experimentalGetDefaultTemplateTypes(state), { 3320 slug 3321 }) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]); 3322 /** 3323 * Given a template entity, return information about it which is ready to be 3324 * rendered, such as the title, description, and icon. 3325 * 3326 * @param {Object} state Global application state. 3327 * @param {Object} template The template for which we need information. 3328 * @return {Object} Information about the template, including title, description, and icon. 3329 */ 3330 3331 function __experimentalGetTemplateInfo(state, template) { 3332 var _experimentalGetDefa; 3333 3334 if (!template) { 3335 return {}; 3336 } 3337 3338 const { 3339 excerpt, 3340 slug, 3341 title, 3342 area 3343 } = template; 3344 3345 const { 3346 title: defaultTitle, 3347 description: defaultDescription 3348 } = __experimentalGetDefaultTemplateType(state, slug); 3349 3350 const templateTitle = (0,external_lodash_namespaceObject.isString)(title) ? title : title === null || title === void 0 ? void 0 : title.rendered; 3351 const templateDescription = (0,external_lodash_namespaceObject.isString)(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw; 3352 const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || library_layout; 3353 return { 3354 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 3355 description: templateDescription || defaultDescription, 3356 icon: templateIcon 3357 }; 3358 } 3359 /** 3360 * Returns a post type label depending on the current post. 3361 * 3362 * @param {Object} state Global application state. 3363 * 3364 * @return {string|undefined} The post type label if available, otherwise undefined. 3365 */ 3366 3367 const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3368 var _postType$labels; 3369 3370 const currentPostType = getCurrentPostType(state); 3371 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); // Disable reason: Post type labels object is shaped like this. 3372 // eslint-disable-next-line camelcase 3373 3374 return postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.singular_name; 3375 }); 3376 3377 ;// CONCATENATED MODULE: external ["wp","apiFetch"] 3378 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 3379 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 3380 ;// CONCATENATED MODULE: external ["wp","notices"] 3381 var external_wp_notices_namespaceObject = window["wp"]["notices"]; 3382 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js 3383 /** 3384 * Function returning a sessionStorage key to set or retrieve a given post's 3385 * automatic session backup. 3386 * 3387 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's 3388 * `loggedout` handler can clear sessionStorage of any user-private content. 3389 * 3390 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 3391 * 3392 * @param {string} postId Post ID. 3393 * @param {boolean} isPostNew Whether post new. 3394 * 3395 * @return {string} sessionStorage key 3396 */ 3397 function postKey(postId, isPostNew) { 3398 return `wp-autosave-block-editor-post-$isPostNew ? 'auto-draft' : postId}`; 3399 } 3400 3401 function localAutosaveGet(postId, isPostNew) { 3402 return window.sessionStorage.getItem(postKey(postId, isPostNew)); 3403 } 3404 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { 3405 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ 3406 post_title: title, 3407 content, 3408 excerpt 3409 })); 3410 } 3411 function localAutosaveClear(postId, isPostNew) { 3412 window.sessionStorage.removeItem(postKey(postId, isPostNew)); 3413 } 3414 3415 ;// CONCATENATED MODULE: external ["wp","i18n"] 3416 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 3417 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js 3418 /** 3419 * WordPress dependencies 3420 */ 3421 3422 /** 3423 * Internal dependencies 3424 */ 3425 3426 3427 /** 3428 * External dependencies 3429 */ 3430 3431 3432 /** 3433 * Builds the arguments for a success notification dispatch. 3434 * 3435 * @param {Object} data Incoming data to build the arguments from. 3436 * 3437 * @return {Array} Arguments for dispatch. An empty array signals no 3438 * notification should be sent. 3439 */ 3440 3441 function getNotificationArgumentsForSaveSuccess(data) { 3442 const { 3443 previousPost, 3444 post, 3445 postType 3446 } = data; // Autosaves are neither shown a notice nor redirected. 3447 3448 if ((0,external_lodash_namespaceObject.get)(data.options, ['isAutosave'])) { 3449 return []; 3450 } // No notice is shown after trashing a post 3451 3452 3453 if (post.status === 'trash' && previousPost.status !== 'trash') { 3454 return []; 3455 } 3456 3457 const publishStatus = ['publish', 'private', 'future']; 3458 const isPublished = (0,external_lodash_namespaceObject.includes)(publishStatus, previousPost.status); 3459 const willPublish = (0,external_lodash_namespaceObject.includes)(publishStatus, post.status); 3460 let noticeMessage; 3461 let shouldShowLink = (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false); 3462 let isDraft; // Always should a notice, which will be spoken for accessibility. 3463 3464 if (!isPublished && !willPublish) { 3465 // If saving a non-published post, don't show notice. 3466 noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.'); 3467 isDraft = true; 3468 } else if (isPublished && !willPublish) { 3469 // If undoing publish status, show specific notice. 3470 noticeMessage = postType.labels.item_reverted_to_draft; 3471 shouldShowLink = false; 3472 } else if (!isPublished && willPublish) { 3473 // If publishing or scheduling a post, show the corresponding 3474 // publish message. 3475 noticeMessage = { 3476 publish: postType.labels.item_published, 3477 private: postType.labels.item_published_privately, 3478 future: postType.labels.item_scheduled 3479 }[post.status]; 3480 } else { 3481 // Generic fallback notice. 3482 noticeMessage = postType.labels.item_updated; 3483 } 3484 3485 const actions = []; 3486 3487 if (shouldShowLink) { 3488 actions.push({ 3489 label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item, 3490 url: post.link 3491 }); 3492 } 3493 3494 return [noticeMessage, { 3495 id: SAVE_POST_NOTICE_ID, 3496 type: 'snackbar', 3497 actions 3498 }]; 3499 } 3500 /** 3501 * Builds the fail notification arguments for dispatch. 3502 * 3503 * @param {Object} data Incoming data to build the arguments with. 3504 * 3505 * @return {Array} Arguments for dispatch. An empty array signals no 3506 * notification should be sent. 3507 */ 3508 3509 function getNotificationArgumentsForSaveFail(data) { 3510 const { 3511 post, 3512 edits, 3513 error 3514 } = data; 3515 3516 if (error && 'rest_autosave_no_changes' === error.code) { 3517 // Autosave requested a new autosave, but there were no changes. This shouldn't 3518 // result in an error notice for the user. 3519 return []; 3520 } 3521 3522 const publishStatus = ['publish', 'private', 'future']; 3523 const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message 3524 // Unless we publish an "updating failed" message. 3525 3526 const messages = { 3527 publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 3528 private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 3529 future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.') 3530 }; 3531 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); // Check if message string contains HTML. Notice text is currently only 3532 // supported as plaintext, and stripping the tags may muddle the meaning. 3533 3534 if (error.message && !/<\/?[^>]*>/.test(error.message)) { 3535 noticeMessage = [noticeMessage, error.message].join(' '); 3536 } 3537 3538 return [noticeMessage, { 3539 id: SAVE_POST_NOTICE_ID 3540 }]; 3541 } 3542 /** 3543 * Builds the trash fail notification arguments for dispatch. 3544 * 3545 * @param {Object} data 3546 * 3547 * @return {Array} Arguments for dispatch. 3548 */ 3549 3550 function getNotificationArgumentsForTrashFail(data) { 3551 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), { 3552 id: TRASH_POST_NOTICE_ID 3553 }]; 3554 } 3555 3556 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js 3557 /** 3558 * External dependencies 3559 */ 3560 3561 /** 3562 * WordPress dependencies 3563 */ 3564 3565 3566 3567 3568 3569 3570 3571 3572 /** 3573 * Internal dependencies 3574 */ 3575 3576 3577 3578 3579 /** 3580 * Returns an action generator used in signalling that editor has initialized with 3581 * the specified post object and editor settings. 3582 * 3583 * @param {Object} post Post object. 3584 * @param {Object} edits Initial edited attributes object. 3585 * @param {Array?} template Block Template. 3586 */ 3587 3588 const setupEditor = (post, edits, template) => _ref => { 3589 let { 3590 dispatch 3591 } = _ref; 3592 dispatch.setupEditorState(post); // Apply a template for new posts only, if exists. 3593 3594 const isNewPost = post.status === 'auto-draft'; 3595 3596 if (isNewPost && template) { 3597 // In order to ensure maximum of a single parse during setup, edits are 3598 // included as part of editor setup action. Assume edited content as 3599 // canonical if provided, falling back to post. 3600 let content; 3601 3602 if ((0,external_lodash_namespaceObject.has)(edits, ['content'])) { 3603 content = edits.content; 3604 } else { 3605 content = post.content.raw; 3606 } 3607 3608 let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); 3609 blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); 3610 dispatch.resetEditorBlocks(blocks, { 3611 __unstableShouldCreateUndoLevel: false 3612 }); 3613 } 3614 3615 if (edits && Object.values(edits).some(_ref2 => { 3616 var _post$key$raw, _post$key; 3617 3618 let [key, edit] = _ref2; 3619 return edit !== ((_post$key$raw = (_post$key = post[key]) === null || _post$key === void 0 ? void 0 : _post$key.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]); 3620 })) { 3621 dispatch.editPost(edits); 3622 } 3623 }; 3624 /** 3625 * Returns an action object signalling that the editor is being destroyed and 3626 * that any necessary state or side-effect cleanup should occur. 3627 * 3628 * @return {Object} Action object. 3629 */ 3630 3631 function __experimentalTearDownEditor() { 3632 return { 3633 type: 'TEAR_DOWN_EDITOR' 3634 }; 3635 } 3636 /** 3637 * Returns an action object used in signalling that the latest version of the 3638 * post has been received, either by initialization or save. 3639 * 3640 * @deprecated Since WordPress 6.0. 3641 */ 3642 3643 function resetPost() { 3644 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { 3645 since: '6.0', 3646 version: '6.3', 3647 alternative: 'Initialize the editor with the setupEditorState action' 3648 }); 3649 return { 3650 type: 'DO_NOTHING' 3651 }; 3652 } 3653 /** 3654 * Returns an action object used in signalling that a patch of updates for the 3655 * latest version of the post have been received. 3656 * 3657 * @return {Object} Action object. 3658 * @deprecated since Gutenberg 9.7.0. 3659 */ 3660 3661 function updatePost() { 3662 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { 3663 since: '5.7', 3664 alternative: 'Use the core entities store instead' 3665 }); 3666 return { 3667 type: 'DO_NOTHING' 3668 }; 3669 } 3670 /** 3671 * Returns an action object used to setup the editor state when first opening 3672 * an editor. 3673 * 3674 * @param {Object} post Post object. 3675 * 3676 * @return {Object} Action object. 3677 */ 3678 3679 function setupEditorState(post) { 3680 return { 3681 type: 'SETUP_EDITOR_STATE', 3682 post 3683 }; 3684 } 3685 /** 3686 * Returns an action object used in signalling that attributes of the post have 3687 * been edited. 3688 * 3689 * @param {Object} edits Post attributes to edit. 3690 * @param {Object} options Options for the edit. 3691 */ 3692 3693 const editPost = (edits, options) => _ref3 => { 3694 let { 3695 select, 3696 registry 3697 } = _ref3; 3698 const { 3699 id, 3700 type 3701 } = select.getCurrentPost(); 3702 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options); 3703 }; 3704 /** 3705 * Action for saving the current post in the editor. 3706 * 3707 * @param {Object} options 3708 */ 3709 3710 const savePost = function () { 3711 let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 3712 return async _ref4 => { 3713 let { 3714 select, 3715 dispatch, 3716 registry 3717 } = _ref4; 3718 3719 if (!select.isEditedPostSaveable()) { 3720 return; 3721 } 3722 3723 const content = select.getEditedPostContent(); 3724 3725 if (!options.isAutosave) { 3726 dispatch.editPost({ 3727 content 3728 }, { 3729 undoIgnore: true 3730 }); 3731 } 3732 3733 const previousRecord = select.getCurrentPost(); 3734 const edits = { 3735 id: previousRecord.id, 3736 ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id), 3737 content 3738 }; 3739 dispatch({ 3740 type: 'REQUEST_POST_UPDATE_START', 3741 options 3742 }); 3743 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options); 3744 dispatch({ 3745 type: 'REQUEST_POST_UPDATE_FINISH', 3746 options 3747 }); 3748 const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id); 3749 3750 if (error) { 3751 const args = getNotificationArgumentsForSaveFail({ 3752 post: previousRecord, 3753 edits, 3754 error 3755 }); 3756 3757 if (args.length) { 3758 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); 3759 } 3760 } else { 3761 const updatedRecord = select.getCurrentPost(); 3762 const args = getNotificationArgumentsForSaveSuccess({ 3763 previousPost: previousRecord, 3764 post: updatedRecord, 3765 postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), 3766 options 3767 }); 3768 3769 if (args.length) { 3770 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); 3771 } // Make sure that any edits after saving create an undo level and are 3772 // considered for change detection. 3773 3774 3775 if (!options.isAutosave) { 3776 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 3777 } 3778 } 3779 }; 3780 }; 3781 /** 3782 * Action for refreshing the current post. 3783 * 3784 * @deprecated Since WordPress 6.0. 3785 */ 3786 3787 function refreshPost() { 3788 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { 3789 since: '6.0', 3790 version: '6.3', 3791 alternative: 'Use the core entities store instead' 3792 }); 3793 return { 3794 type: 'DO_NOTHING' 3795 }; 3796 } 3797 /** 3798 * Action for trashing the current post in the editor. 3799 */ 3800 3801 const trashPost = () => async _ref5 => { 3802 let { 3803 select, 3804 dispatch, 3805 registry 3806 } = _ref5; 3807 const postTypeSlug = select.getCurrentPostType(); 3808 const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 3809 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID); 3810 3811 try { 3812 const post = select.getCurrentPost(); 3813 await external_wp_apiFetch_default()({ 3814 path: `/wp/v2/$postType.rest_base}/$post.id}`, 3815 method: 'DELETE' 3816 }); 3817 await dispatch.savePost(); 3818 } catch (error) { 3819 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({ 3820 error 3821 })); 3822 } 3823 }; 3824 /** 3825 * Action that autosaves the current post. This 3826 * includes server-side autosaving (default) and client-side (a.k.a. local) 3827 * autosaving (e.g. on the Web, the post might be committed to Session 3828 * Storage). 3829 * 3830 * @param {Object?} options Extra flags to identify the autosave. 3831 */ 3832 3833 const autosave = function () { 3834 let { 3835 local = false, 3836 ...options 3837 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 3838 return async _ref6 => { 3839 let { 3840 select, 3841 dispatch 3842 } = _ref6; 3843 3844 if (local) { 3845 const post = select.getCurrentPost(); 3846 const isPostNew = select.isEditedPostNew(); 3847 const title = select.getEditedPostAttribute('title'); 3848 const content = select.getEditedPostAttribute('content'); 3849 const excerpt = select.getEditedPostAttribute('excerpt'); 3850 localAutosaveSet(post.id, isPostNew, title, content, excerpt); 3851 } else { 3852 await dispatch.savePost({ 3853 isAutosave: true, 3854 ...options 3855 }); 3856 } 3857 }; 3858 }; 3859 /** 3860 * Action that restores last popped state in undo history. 3861 */ 3862 3863 const redo = () => _ref7 => { 3864 let { 3865 registry 3866 } = _ref7; 3867 registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); 3868 }; 3869 /** 3870 * Action that pops a record from undo history and undoes the edit. 3871 */ 3872 3873 const undo = () => _ref8 => { 3874 let { 3875 registry 3876 } = _ref8; 3877 registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); 3878 }; 3879 /** 3880 * Action that creates an undo history record. 3881 * 3882 * @deprecated Since WordPress 6.0 3883 */ 3884 3885 function createUndoLevel() { 3886 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { 3887 since: '6.0', 3888 version: '6.3', 3889 alternative: 'Use the core entities store instead' 3890 }); 3891 return { 3892 type: 'DO_NOTHING' 3893 }; 3894 } 3895 /** 3896 * Action that locks the editor. 3897 * 3898 * @param {Object} lock Details about the post lock status, user, and nonce. 3899 * @return {Object} Action object. 3900 */ 3901 3902 function updatePostLock(lock) { 3903 return { 3904 type: 'UPDATE_POST_LOCK', 3905 lock 3906 }; 3907 } 3908 /** 3909 * Enable the publish sidebar. 3910 */ 3911 3912 const enablePublishSidebar = () => _ref9 => { 3913 let { 3914 registry 3915 } = _ref9; 3916 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', true); 3917 }; 3918 /** 3919 * Disables the publish sidebar. 3920 */ 3921 3922 const disablePublishSidebar = () => _ref10 => { 3923 let { 3924 registry 3925 } = _ref10; 3926 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', false); 3927 }; 3928 /** 3929 * Action that locks post saving. 3930 * 3931 * @param {string} lockName The lock name. 3932 * 3933 * @example 3934 * ``` 3935 * const { subscribe } = wp.data; 3936 * 3937 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 3938 * 3939 * // Only allow publishing posts that are set to a future date. 3940 * if ( 'publish' !== initialPostStatus ) { 3941 * 3942 * // Track locking. 3943 * let locked = false; 3944 * 3945 * // Watch for the publish event. 3946 * let unssubscribe = subscribe( () => { 3947 * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 3948 * if ( 'publish' !== currentPostStatus ) { 3949 * 3950 * // Compare the post date to the current date, lock the post if the date isn't in the future. 3951 * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); 3952 * const currentDate = new Date(); 3953 * if ( postDate.getTime() <= currentDate.getTime() ) { 3954 * if ( ! locked ) { 3955 * locked = true; 3956 * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); 3957 * } 3958 * } else { 3959 * if ( locked ) { 3960 * locked = false; 3961 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); 3962 * } 3963 * } 3964 * } 3965 * } ); 3966 * } 3967 * ``` 3968 * 3969 * @return {Object} Action object 3970 */ 3971 3972 function lockPostSaving(lockName) { 3973 return { 3974 type: 'LOCK_POST_SAVING', 3975 lockName 3976 }; 3977 } 3978 /** 3979 * Action that unlocks post saving. 3980 * 3981 * @param {string} lockName The lock name. 3982 * 3983 * @example 3984 * ``` 3985 * // Unlock post saving with the lock key `mylock`: 3986 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); 3987 * ``` 3988 * 3989 * @return {Object} Action object 3990 */ 3991 3992 function unlockPostSaving(lockName) { 3993 return { 3994 type: 'UNLOCK_POST_SAVING', 3995 lockName 3996 }; 3997 } 3998 /** 3999 * Action that locks post autosaving. 4000 * 4001 * @param {string} lockName The lock name. 4002 * 4003 * @example 4004 * ``` 4005 * // Lock post autosaving with the lock key `mylock`: 4006 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); 4007 * ``` 4008 * 4009 * @return {Object} Action object 4010 */ 4011 4012 function lockPostAutosaving(lockName) { 4013 return { 4014 type: 'LOCK_POST_AUTOSAVING', 4015 lockName 4016 }; 4017 } 4018 /** 4019 * Action that unlocks post autosaving. 4020 * 4021 * @param {string} lockName The lock name. 4022 * 4023 * @example 4024 * ``` 4025 * // Unlock post saving with the lock key `mylock`: 4026 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); 4027 * ``` 4028 * 4029 * @return {Object} Action object 4030 */ 4031 4032 function unlockPostAutosaving(lockName) { 4033 return { 4034 type: 'UNLOCK_POST_AUTOSAVING', 4035 lockName 4036 }; 4037 } 4038 /** 4039 * Returns an action object used to signal that the blocks have been updated. 4040 * 4041 * @param {Array} blocks Block Array. 4042 * @param {?Object} options Optional options. 4043 */ 4044 4045 const resetEditorBlocks = function (blocks) { 4046 let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4047 return _ref11 => { 4048 let { 4049 select, 4050 dispatch, 4051 registry 4052 } = _ref11; 4053 const { 4054 __unstableShouldCreateUndoLevel, 4055 selection 4056 } = options; 4057 const edits = { 4058 blocks, 4059 selection 4060 }; 4061 4062 if (__unstableShouldCreateUndoLevel !== false) { 4063 const { 4064 id, 4065 type 4066 } = select.getCurrentPost(); 4067 const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks; 4068 4069 if (noChange) { 4070 registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id); 4071 4072 return; 4073 } // We create a new function here on every persistent edit 4074 // to make sure the edit makes the post dirty and creates 4075 // a new undo level. 4076 4077 4078 edits.content = _ref12 => { 4079 let { 4080 blocks: blocksForSerialization = [] 4081 } = _ref12; 4082 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 4083 }; 4084 } 4085 4086 dispatch.editPost(edits); 4087 }; 4088 }; 4089 /* 4090 * Returns an action object used in signalling that the post editor settings have been updated. 4091 * 4092 * @param {Object} settings Updated settings 4093 * 4094 * @return {Object} Action object 4095 */ 4096 4097 function updateEditorSettings(settings) { 4098 return { 4099 type: 'UPDATE_EDITOR_SETTINGS', 4100 settings 4101 }; 4102 } 4103 /** 4104 * Backward compatibility 4105 */ 4106 4107 const getBlockEditorAction = name => function () { 4108 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 4109 args[_key] = arguments[_key]; 4110 } 4111 4112 return _ref13 => { 4113 let { 4114 registry 4115 } = _ref13; 4116 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { 4117 since: '5.3', 4118 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`', 4119 version: '6.2' 4120 }); 4121 registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); 4122 }; 4123 }; 4124 /** 4125 * @see resetBlocks in core/block-editor store. 4126 */ 4127 4128 4129 const resetBlocks = getBlockEditorAction('resetBlocks'); 4130 /** 4131 * @see receiveBlocks in core/block-editor store. 4132 */ 4133 4134 const receiveBlocks = getBlockEditorAction('receiveBlocks'); 4135 /** 4136 * @see updateBlock in core/block-editor store. 4137 */ 4138 4139 const updateBlock = getBlockEditorAction('updateBlock'); 4140 /** 4141 * @see updateBlockAttributes in core/block-editor store. 4142 */ 4143 4144 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); 4145 /** 4146 * @see selectBlock in core/block-editor store. 4147 */ 4148 4149 const selectBlock = getBlockEditorAction('selectBlock'); 4150 /** 4151 * @see startMultiSelect in core/block-editor store. 4152 */ 4153 4154 const startMultiSelect = getBlockEditorAction('startMultiSelect'); 4155 /** 4156 * @see stopMultiSelect in core/block-editor store. 4157 */ 4158 4159 const stopMultiSelect = getBlockEditorAction('stopMultiSelect'); 4160 /** 4161 * @see multiSelect in core/block-editor store. 4162 */ 4163 4164 const multiSelect = getBlockEditorAction('multiSelect'); 4165 /** 4166 * @see clearSelectedBlock in core/block-editor store. 4167 */ 4168 4169 const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); 4170 /** 4171 * @see toggleSelection in core/block-editor store. 4172 */ 4173 4174 const toggleSelection = getBlockEditorAction('toggleSelection'); 4175 /** 4176 * @see replaceBlocks in core/block-editor store. 4177 */ 4178 4179 const replaceBlocks = getBlockEditorAction('replaceBlocks'); 4180 /** 4181 * @see replaceBlock in core/block-editor store. 4182 */ 4183 4184 const replaceBlock = getBlockEditorAction('replaceBlock'); 4185 /** 4186 * @see moveBlocksDown in core/block-editor store. 4187 */ 4188 4189 const moveBlocksDown = getBlockEditorAction('moveBlocksDown'); 4190 /** 4191 * @see moveBlocksUp in core/block-editor store. 4192 */ 4193 4194 const moveBlocksUp = getBlockEditorAction('moveBlocksUp'); 4195 /** 4196 * @see moveBlockToPosition in core/block-editor store. 4197 */ 4198 4199 const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition'); 4200 /** 4201 * @see insertBlock in core/block-editor store. 4202 */ 4203 4204 const insertBlock = getBlockEditorAction('insertBlock'); 4205 /** 4206 * @see insertBlocks in core/block-editor store. 4207 */ 4208 4209 const insertBlocks = getBlockEditorAction('insertBlocks'); 4210 /** 4211 * @see showInsertionPoint in core/block-editor store. 4212 */ 4213 4214 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); 4215 /** 4216 * @see hideInsertionPoint in core/block-editor store. 4217 */ 4218 4219 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); 4220 /** 4221 * @see setTemplateValidity in core/block-editor store. 4222 */ 4223 4224 const setTemplateValidity = getBlockEditorAction('setTemplateValidity'); 4225 /** 4226 * @see synchronizeTemplate in core/block-editor store. 4227 */ 4228 4229 const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); 4230 /** 4231 * @see mergeBlocks in core/block-editor store. 4232 */ 4233 4234 const mergeBlocks = getBlockEditorAction('mergeBlocks'); 4235 /** 4236 * @see removeBlocks in core/block-editor store. 4237 */ 4238 4239 const removeBlocks = getBlockEditorAction('removeBlocks'); 4240 /** 4241 * @see removeBlock in core/block-editor store. 4242 */ 4243 4244 const removeBlock = getBlockEditorAction('removeBlock'); 4245 /** 4246 * @see toggleBlockMode in core/block-editor store. 4247 */ 4248 4249 const toggleBlockMode = getBlockEditorAction('toggleBlockMode'); 4250 /** 4251 * @see startTyping in core/block-editor store. 4252 */ 4253 4254 const startTyping = getBlockEditorAction('startTyping'); 4255 /** 4256 * @see stopTyping in core/block-editor store. 4257 */ 4258 4259 const stopTyping = getBlockEditorAction('stopTyping'); 4260 /** 4261 * @see enterFormattedText in core/block-editor store. 4262 */ 4263 4264 const enterFormattedText = getBlockEditorAction('enterFormattedText'); 4265 /** 4266 * @see exitFormattedText in core/block-editor store. 4267 */ 4268 4269 const exitFormattedText = getBlockEditorAction('exitFormattedText'); 4270 /** 4271 * @see insertDefaultBlock in core/block-editor store. 4272 */ 4273 4274 const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); 4275 /** 4276 * @see updateBlockListSettings in core/block-editor store. 4277 */ 4278 4279 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); 4280 4281 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js 4282 /** 4283 * WordPress dependencies 4284 */ 4285 4286 /** 4287 * Internal dependencies 4288 */ 4289 4290 4291 4292 4293 4294 /** 4295 * Post editor data store configuration. 4296 * 4297 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore 4298 * 4299 * @type {Object} 4300 */ 4301 4302 const storeConfig = { 4303 reducer: reducer, 4304 selectors: selectors_namespaceObject, 4305 actions: actions_namespaceObject 4306 }; 4307 /** 4308 * Store definition for the editor namespace. 4309 * 4310 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 4311 * 4312 * @type {Object} 4313 */ 4314 4315 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig 4316 }); 4317 (0,external_wp_data_namespaceObject.register)(store_store); 4318 4319 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js 4320 4321 4322 4323 /** 4324 * External dependencies 4325 */ 4326 4327 /** 4328 * WordPress dependencies 4329 */ 4330 4331 4332 4333 4334 4335 4336 4337 /** 4338 * Internal dependencies 4339 */ 4340 4341 4342 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ 4343 4344 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 4345 4346 /** 4347 * Object whose keys are the names of block attributes, where each value 4348 * represents the meta key to which the block attribute is intended to save. 4349 * 4350 * @see https://developer.wordpress.org/reference/functions/register_meta/ 4351 * 4352 * @typedef {Object<string,string>} WPMetaAttributeMapping 4353 */ 4354 4355 /** 4356 * Given a mapping of attribute names (meta source attributes) to their 4357 * associated meta key, returns a higher order component that overrides its 4358 * `attributes` and `setAttributes` props to sync any changes with the edited 4359 * post's meta keys. 4360 * 4361 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. 4362 * 4363 * @return {WPHigherOrderComponent} Higher-order component. 4364 */ 4365 4366 const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => _ref => { 4367 let { 4368 attributes, 4369 setAttributes, 4370 ...props 4371 } = _ref; 4372 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 4373 const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta'); 4374 const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...attributes, 4375 ...(0,external_lodash_namespaceObject.mapValues)(metaAttributes, metaKey => meta[metaKey]) 4376 }), [attributes, meta]); 4377 return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({ 4378 attributes: mergedAttributes, 4379 setAttributes: nextAttributes => { 4380 const nextMeta = (0,external_lodash_namespaceObject.mapKeys)( // Filter to intersection of keys between the updated 4381 // attributes and those with an associated meta key. 4382 (0,external_lodash_namespaceObject.pickBy)(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name. 4383 (value, attributeKey) => metaAttributes[attributeKey]); 4384 4385 if (!(0,external_lodash_namespaceObject.isEmpty)(nextMeta)) { 4386 setMeta(nextMeta); 4387 } 4388 4389 setAttributes(nextAttributes); 4390 } 4391 }, props)); 4392 }, 'withMetaAttributeSource'); 4393 /** 4394 * Filters a registered block's settings to enhance a block's `edit` component 4395 * to upgrade meta-sourced attributes to use the post's meta entity property. 4396 * 4397 * @param {WPBlockSettings} settings Registered block settings. 4398 * 4399 * @return {WPBlockSettings} Filtered block settings. 4400 */ 4401 4402 4403 function shimAttributeSource(settings) { 4404 /** @type {WPMetaAttributeMapping} */ 4405 const metaAttributes = (0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.pickBy)(settings.attributes, { 4406 source: 'meta' 4407 }), 'meta'); 4408 4409 if (!(0,external_lodash_namespaceObject.isEmpty)(metaAttributes)) { 4410 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); 4411 } 4412 4413 return settings; 4414 } 4415 4416 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was 4417 // added. There may already be blocks registered by this point, and those must 4418 // be updated to apply the shim. 4419 // 4420 // The following implementation achieves this, albeit with a couple caveats: 4421 // - Only blocks registered on the global store will be modified. 4422 // - The block settings are directly mutated, since there is currently no 4423 // mechanism to update an existing block registration. This is the reason for 4424 // `getBlockType` separate from `getBlockTypes`, since the latter returns a 4425 // _copy_ of the block registration (i.e. the mutation would not affect the 4426 // actual registered block settings). 4427 // 4428 // `getBlockTypes` or `getBlockType` implementation could change in the future 4429 // in regards to creating settings clones, but the corresponding end-to-end 4430 // tests for meta blocks should cover against any potential regressions. 4431 // 4432 // In the future, we could support updating block settings, at which point this 4433 // implementation could use that mechanism instead. 4434 4435 (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockTypes().map(_ref2 => { 4436 let { 4437 name 4438 } = _ref2; 4439 return (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockType(name); 4440 }).forEach(shimAttributeSource); 4441 4442 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js 4443 4444 4445 /** 4446 * WordPress dependencies 4447 */ 4448 4449 4450 4451 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ 4452 4453 function getUserLabel(user) { 4454 const avatar = user.avatar_urls && user.avatar_urls[24] ? (0,external_wp_element_namespaceObject.createElement)("img", { 4455 className: "editor-autocompleters__user-avatar", 4456 alt: "", 4457 src: user.avatar_urls[24] 4458 }) : (0,external_wp_element_namespaceObject.createElement)("span", { 4459 className: "editor-autocompleters__no-avatar" 4460 }); 4461 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, avatar, (0,external_wp_element_namespaceObject.createElement)("span", { 4462 className: "editor-autocompleters__user-name" 4463 }, user.name), (0,external_wp_element_namespaceObject.createElement)("span", { 4464 className: "editor-autocompleters__user-slug" 4465 }, user.slug)); 4466 } 4467 /** 4468 * A user mentions completer. 4469 * 4470 * @type {WPCompleter} 4471 */ 4472 4473 /* harmony default export */ var user = ({ 4474 name: 'users', 4475 className: 'editor-autocompleters__user', 4476 triggerPrefix: '@', 4477 4478 useItems(filterValue) { 4479 const users = (0,external_wp_data_namespaceObject.useSelect)(select => { 4480 const { 4481 getUsers 4482 } = select(external_wp_coreData_namespaceObject.store); 4483 return getUsers({ 4484 context: 'view', 4485 search: encodeURIComponent(filterValue) 4486 }); 4487 }, [filterValue]); 4488 const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({ 4489 key: `user-$user.slug}`, 4490 value: user, 4491 label: getUserLabel(user) 4492 })) : [], [users]); 4493 return [options]; 4494 }, 4495 4496 getOptionCompletion(user) { 4497 return `@$user.slug}`; 4498 } 4499 4500 }); 4501 4502 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js 4503 /** 4504 * External dependencies 4505 */ 4506 4507 /** 4508 * WordPress dependencies 4509 */ 4510 4511 4512 /** 4513 * Internal dependencies 4514 */ 4515 4516 4517 4518 function setDefaultCompleters() { 4519 let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 4520 // Provide copies so filters may directly modify them. 4521 completers.push((0,external_lodash_namespaceObject.clone)(user)); 4522 return completers; 4523 } 4524 4525 (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); 4526 4527 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js 4528 /** 4529 * Internal dependencies 4530 */ 4531 4532 4533 4534 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js 4535 4536 4537 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js 4538 /** 4539 * WordPress dependencies 4540 */ 4541 4542 4543 4544 4545 /** 4546 * Internal dependencies 4547 */ 4548 4549 4550 /** 4551 * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected. 4552 * 4553 * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. 4554 * 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 4555 * the specific way of detecting changes. 4556 * 4557 * There are two caveats: 4558 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. 4559 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. 4560 */ 4561 4562 class AutosaveMonitor extends external_wp_element_namespaceObject.Component { 4563 constructor(props) { 4564 super(props); 4565 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); 4566 } 4567 4568 componentDidMount() { 4569 if (!this.props.disableIntervalChecks) { 4570 this.setAutosaveTimer(); 4571 } 4572 } 4573 4574 componentDidUpdate(prevProps) { 4575 if (this.props.disableIntervalChecks) { 4576 if (this.props.editsReference !== prevProps.editsReference) { 4577 this.props.autosave(); 4578 } 4579 4580 return; 4581 } 4582 4583 if (this.props.interval !== prevProps.interval) { 4584 clearTimeout(this.timerId); 4585 this.setAutosaveTimer(); 4586 } 4587 4588 if (!this.props.isDirty) { 4589 this.needsAutosave = false; 4590 return; 4591 } 4592 4593 if (this.props.isAutosaving && !prevProps.isAutosaving) { 4594 this.needsAutosave = false; 4595 return; 4596 } 4597 4598 if (this.props.editsReference !== prevProps.editsReference) { 4599 this.needsAutosave = true; 4600 } 4601 } 4602 4603 componentWillUnmount() { 4604 clearTimeout(this.timerId); 4605 } 4606 4607 setAutosaveTimer() { 4608 let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.interval * 1000; 4609 this.timerId = setTimeout(() => { 4610 this.autosaveTimerHandler(); 4611 }, timeout); 4612 } 4613 4614 autosaveTimerHandler() { 4615 if (!this.props.isAutosaveable) { 4616 this.setAutosaveTimer(1000); 4617 return; 4618 } 4619 4620 if (this.needsAutosave) { 4621 this.needsAutosave = false; 4622 this.props.autosave(); 4623 } 4624 4625 this.setAutosaveTimer(); 4626 } 4627 4628 render() { 4629 return null; 4630 } 4631 4632 } 4633 /* harmony default export */ var autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { 4634 const { 4635 getReferenceByDistinctEdits 4636 } = select(external_wp_coreData_namespaceObject.store); 4637 const { 4638 isEditedPostDirty, 4639 isEditedPostAutosaveable, 4640 isAutosavingPost, 4641 getEditorSettings 4642 } = select(store_store); 4643 const { 4644 interval = getEditorSettings().autosaveInterval 4645 } = ownProps; 4646 return { 4647 editsReference: getReferenceByDistinctEdits(), 4648 isDirty: isEditedPostDirty(), 4649 isAutosaveable: isEditedPostAutosaveable(), 4650 isAutosaving: isAutosavingPost(), 4651 interval 4652 }; 4653 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ 4654 autosave() { 4655 const { 4656 autosave = dispatch(store_store).autosave 4657 } = ownProps; 4658 autosave(); 4659 } 4660 4661 }))])(AutosaveMonitor)); 4662 4663 ;// CONCATENATED MODULE: external ["wp","richText"] 4664 var external_wp_richText_namespaceObject = window["wp"]["richText"]; 4665 // EXTERNAL MODULE: ./node_modules/classnames/index.js 4666 var classnames = __webpack_require__(4403); 4667 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 4668 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js 4669 4670 4671 /** 4672 * External dependencies 4673 */ 4674 4675 4676 const TableOfContentsItem = _ref => { 4677 let { 4678 children, 4679 isValid, 4680 level, 4681 href, 4682 onSelect 4683 } = _ref; 4684 return (0,external_wp_element_namespaceObject.createElement)("li", { 4685 className: classnames_default()('document-outline__item', `is-$level.toLowerCase()}`, { 4686 'is-invalid': !isValid 4687 }) 4688 }, (0,external_wp_element_namespaceObject.createElement)("a", { 4689 href: href, 4690 className: "document-outline__button", 4691 onClick: onSelect 4692 }, (0,external_wp_element_namespaceObject.createElement)("span", { 4693 className: "document-outline__emdash", 4694 "aria-hidden": "true" 4695 }), (0,external_wp_element_namespaceObject.createElement)("strong", { 4696 className: "document-outline__level" 4697 }, level), (0,external_wp_element_namespaceObject.createElement)("span", { 4698 className: "document-outline__item-content" 4699 }, children))); 4700 }; 4701 4702 /* harmony default export */ var document_outline_item = (TableOfContentsItem); 4703 4704 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js 4705 4706 4707 /** 4708 * External dependencies 4709 */ 4710 4711 /** 4712 * WordPress dependencies 4713 */ 4714 4715 4716 4717 4718 4719 4720 4721 /** 4722 * Internal dependencies 4723 */ 4724 4725 4726 4727 /** 4728 * Module constants 4729 */ 4730 4731 const emptyHeadingContent = (0,external_wp_element_namespaceObject.createElement)("em", null, (0,external_wp_i18n_namespaceObject.__)('(Empty heading)')); 4732 const incorrectLevelContent = [(0,external_wp_element_namespaceObject.createElement)("br", { 4733 key: "incorrect-break" 4734 }), (0,external_wp_element_namespaceObject.createElement)("em", { 4735 key: "incorrect-message" 4736 }, (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)'))]; 4737 const singleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", { 4738 key: "incorrect-break-h1" 4739 }), (0,external_wp_element_namespaceObject.createElement)("em", { 4740 key: "incorrect-message-h1" 4741 }, (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)'))]; 4742 const multipleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", { 4743 key: "incorrect-break-multiple-h1" 4744 }), (0,external_wp_element_namespaceObject.createElement)("em", { 4745 key: "incorrect-message-multiple-h1" 4746 }, (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)'))]; 4747 /** 4748 * Returns an array of heading blocks enhanced with the following properties: 4749 * level - An integer with the heading level. 4750 * isEmpty - Flag indicating if the heading has no content. 4751 * 4752 * @param {?Array} blocks An array of blocks. 4753 * 4754 * @return {Array} An array of heading blocks enhanced with the properties described above. 4755 */ 4756 4757 const computeOutlineHeadings = function () { 4758 let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 4759 return (0,external_lodash_namespaceObject.flatMap)(blocks, function () { 4760 let block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 4761 4762 if (block.name === 'core/heading') { 4763 return { ...block, 4764 level: block.attributes.level, 4765 isEmpty: isEmptyHeading(block) 4766 }; 4767 } 4768 4769 return computeOutlineHeadings(block.innerBlocks); 4770 }); 4771 }; 4772 4773 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0; 4774 4775 const DocumentOutline = _ref => { 4776 let { 4777 blocks = [], 4778 title, 4779 onSelect, 4780 isTitleSupported, 4781 hasOutlineItemsDisabled 4782 } = _ref; 4783 const headings = computeOutlineHeadings(blocks); 4784 4785 if (headings.length < 1) { 4786 return null; 4787 } 4788 4789 let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now. 4790 4791 const titleNode = document.querySelector('.editor-post-title__input'); 4792 const hasTitle = isTitleSupported && title && titleNode; 4793 const countByLevel = (0,external_lodash_namespaceObject.countBy)(headings, 'level'); 4794 const hasMultipleH1 = countByLevel[1] > 1; 4795 return (0,external_wp_element_namespaceObject.createElement)("div", { 4796 className: "document-outline" 4797 }, (0,external_wp_element_namespaceObject.createElement)("ul", null, hasTitle && (0,external_wp_element_namespaceObject.createElement)(document_outline_item, { 4798 level: (0,external_wp_i18n_namespaceObject.__)('Title'), 4799 isValid: true, 4800 onSelect: onSelect, 4801 href: `#$titleNode.id}`, 4802 isDisabled: hasOutlineItemsDisabled 4803 }, title), headings.map((item, index) => { 4804 // Headings remain the same, go up by one, or down by any amount. 4805 // Otherwise there are missing levels. 4806 const isIncorrectLevel = item.level > prevHeadingLevel + 1; 4807 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); 4808 prevHeadingLevel = item.level; 4809 return (0,external_wp_element_namespaceObject.createElement)(document_outline_item, { 4810 key: index, 4811 level: `H$item.level}`, 4812 isValid: isValid, 4813 isDisabled: hasOutlineItemsDisabled, 4814 href: `#block-$item.clientId}`, 4815 onSelect: onSelect 4816 }, item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({ 4817 html: item.attributes.content 4818 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings); 4819 }))); 4820 }; 4821 /* harmony default export */ var document_outline = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { 4822 const { 4823 getBlocks 4824 } = select(external_wp_blockEditor_namespaceObject.store); 4825 const { 4826 getEditedPostAttribute 4827 } = select(store_store); 4828 const { 4829 getPostType 4830 } = select(external_wp_coreData_namespaceObject.store); 4831 const postType = getPostType(getEditedPostAttribute('type')); 4832 return { 4833 title: getEditedPostAttribute('title'), 4834 blocks: getBlocks(), 4835 isTitleSupported: (0,external_lodash_namespaceObject.get)(postType, ['supports', 'title'], false) 4836 }; 4837 }))(DocumentOutline)); 4838 4839 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js 4840 /** 4841 * External dependencies 4842 */ 4843 4844 /** 4845 * WordPress dependencies 4846 */ 4847 4848 4849 4850 4851 function DocumentOutlineCheck(_ref) { 4852 let { 4853 blocks, 4854 children 4855 } = _ref; 4856 const headings = (0,external_lodash_namespaceObject.filter)(blocks, block => block.name === 'core/heading'); 4857 4858 if (headings.length < 1) { 4859 return null; 4860 } 4861 4862 return children; 4863 } 4864 4865 /* harmony default export */ var check = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ 4866 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() 4867 }))(DocumentOutlineCheck)); 4868 4869 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] 4870 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 4871 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js 4872 /** 4873 * WordPress dependencies 4874 */ 4875 4876 4877 4878 /** 4879 * Internal dependencies 4880 */ 4881 4882 4883 4884 function SaveShortcut(_ref) { 4885 let { 4886 resetBlocksOnSave 4887 } = _ref; 4888 const { 4889 resetEditorBlocks, 4890 savePost 4891 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 4892 const { 4893 isEditedPostDirty, 4894 getPostEdits, 4895 isPostSavingLocked 4896 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 4897 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => { 4898 event.preventDefault(); 4899 /** 4900 * Do not save the post if post saving is locked. 4901 */ 4902 4903 if (isPostSavingLocked()) { 4904 return; 4905 } // TODO: This should be handled in the `savePost` effect in 4906 // considering `isSaveable`. See note on `isEditedPostSaveable` 4907 // selector about dirtiness and meta-boxes. 4908 // 4909 // See: `isEditedPostSaveable` 4910 4911 4912 if (!isEditedPostDirty()) { 4913 return; 4914 } // The text editor requires that editor blocks are updated for a 4915 // save to work correctly. Usually this happens when the textarea 4916 // for the code editors blurs, but the shortcut can be used without 4917 // blurring the textarea. 4918 4919 4920 if (resetBlocksOnSave) { 4921 const postEdits = getPostEdits(); 4922 4923 if (postEdits.content && typeof postEdits.content === 'string') { 4924 const blocks = (0,external_wp_blocks_namespaceObject.parse)(postEdits.content); 4925 resetEditorBlocks(blocks); 4926 } 4927 } 4928 4929 savePost(); 4930 }); 4931 return null; 4932 } 4933 4934 /* harmony default export */ var save_shortcut = (SaveShortcut); 4935 4936 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js 4937 4938 4939 /** 4940 * WordPress dependencies 4941 */ 4942 4943 4944 /** 4945 * Internal dependencies 4946 */ 4947 4948 4949 4950 4951 function VisualEditorGlobalKeyboardShortcuts() { 4952 const { 4953 redo, 4954 undo 4955 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 4956 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => { 4957 undo(); 4958 event.preventDefault(); 4959 }); 4960 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => { 4961 redo(); 4962 event.preventDefault(); 4963 }); 4964 return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, null); 4965 } 4966 4967 /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts); 4968 4969 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js 4970 4971 4972 /** 4973 * Internal dependencies 4974 */ 4975 4976 function TextEditorGlobalKeyboardShortcuts() { 4977 return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, { 4978 resetBlocksOnSave: true 4979 }); 4980 } 4981 4982 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js 4983 4984 4985 /** 4986 * WordPress dependencies 4987 */ 4988 4989 4990 4991 4992 4993 4994 function EditorKeyboardShortcutsRegister() { 4995 // Registering the shortcuts. 4996 const { 4997 registerShortcut 4998 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 4999 (0,external_wp_element_namespaceObject.useEffect)(() => { 5000 registerShortcut({ 5001 name: 'core/editor/save', 5002 category: 'global', 5003 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 5004 keyCombination: { 5005 modifier: 'primary', 5006 character: 's' 5007 } 5008 }); 5009 registerShortcut({ 5010 name: 'core/editor/undo', 5011 category: 'global', 5012 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), 5013 keyCombination: { 5014 modifier: 'primary', 5015 character: 'z' 5016 } 5017 }); 5018 registerShortcut({ 5019 name: 'core/editor/redo', 5020 category: 'global', 5021 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), 5022 keyCombination: { 5023 modifier: 'primaryShift', 5024 character: 'z' 5025 } 5026 }); 5027 }, [registerShortcut]); 5028 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null); 5029 } 5030 5031 /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister); 5032 5033 ;// CONCATENATED MODULE: external ["wp","components"] 5034 var external_wp_components_namespaceObject = window["wp"]["components"]; 5035 ;// CONCATENATED MODULE: external ["wp","keycodes"] 5036 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 5037 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js 5038 5039 5040 /** 5041 * WordPress dependencies 5042 */ 5043 5044 const redo_redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5045 xmlns: "http://www.w3.org/2000/svg", 5046 viewBox: "0 0 24 24" 5047 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5048 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" 5049 })); 5050 /* harmony default export */ var library_redo = (redo_redo); 5051 5052 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js 5053 5054 5055 /** 5056 * WordPress dependencies 5057 */ 5058 5059 const undo_undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5060 xmlns: "http://www.w3.org/2000/svg", 5061 viewBox: "0 0 24 24" 5062 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5063 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" 5064 })); 5065 /* harmony default export */ var library_undo = (undo_undo); 5066 5067 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js 5068 5069 5070 5071 /** 5072 * WordPress dependencies 5073 */ 5074 5075 5076 5077 5078 5079 5080 /** 5081 * Internal dependencies 5082 */ 5083 5084 5085 5086 function EditorHistoryRedo(props, ref) { 5087 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []); 5088 const { 5089 redo 5090 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5091 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { 5092 ref: ref, 5093 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo 5094 /* translators: button label text should, if possible, be under 16 characters. */ 5095 , 5096 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), 5097 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no redo levels we don't want to actually disable this 5098 // button, because it will remove focus for keyboard users. 5099 // See: https://github.com/WordPress/gutenberg/issues/3486 5100 , 5101 "aria-disabled": !hasRedo, 5102 onClick: hasRedo ? redo : undefined, 5103 className: "editor-history__redo" 5104 })); 5105 } 5106 5107 /* harmony default export */ var editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo)); 5108 5109 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js 5110 5111 5112 5113 /** 5114 * WordPress dependencies 5115 */ 5116 5117 5118 5119 5120 5121 5122 /** 5123 * Internal dependencies 5124 */ 5125 5126 5127 5128 function EditorHistoryUndo(props, ref) { 5129 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []); 5130 const { 5131 undo 5132 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5133 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { 5134 ref: ref, 5135 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo 5136 /* translators: button label text should, if possible, be under 16 characters. */ 5137 , 5138 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 5139 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this 5140 // button, because it will remove focus for keyboard users. 5141 // See: https://github.com/WordPress/gutenberg/issues/3486 5142 , 5143 "aria-disabled": !hasUndo, 5144 onClick: hasUndo ? undo : undefined, 5145 className: "editor-history__undo" 5146 })); 5147 } 5148 5149 /* harmony default export */ var editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo)); 5150 5151 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js 5152 5153 5154 /** 5155 * WordPress dependencies 5156 */ 5157 5158 5159 5160 5161 5162 5163 function TemplateValidationNotice(_ref) { 5164 let { 5165 isValid, 5166 ...props 5167 } = _ref; 5168 5169 if (isValid) { 5170 return null; 5171 } 5172 5173 const confirmSynchronization = () => { 5174 if ( // eslint-disable-next-line no-alert 5175 window.confirm((0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?'))) { 5176 props.synchronizeTemplate(); 5177 } 5178 }; 5179 5180 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { 5181 className: "editor-template-validation-notice", 5182 isDismissible: false, 5183 status: "warning", 5184 actions: [{ 5185 label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'), 5186 onClick: props.resetTemplateValidity 5187 }, { 5188 label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'), 5189 onClick: confirmSynchronization 5190 }] 5191 }, (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.')); 5192 } 5193 5194 /* harmony default export */ var template_validation_notice = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ 5195 isValid: select(external_wp_blockEditor_namespaceObject.store).isValidTemplate() 5196 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 5197 const { 5198 setTemplateValidity, 5199 synchronizeTemplate 5200 } = dispatch(external_wp_blockEditor_namespaceObject.store); 5201 return { 5202 resetTemplateValidity: () => setTemplateValidity(true), 5203 synchronizeTemplate 5204 }; 5205 })])(TemplateValidationNotice)); 5206 5207 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js 5208 5209 5210 /** 5211 * External dependencies 5212 */ 5213 5214 /** 5215 * WordPress dependencies 5216 */ 5217 5218 5219 5220 5221 5222 /** 5223 * Internal dependencies 5224 */ 5225 5226 5227 function EditorNotices(_ref) { 5228 let { 5229 notices, 5230 onRemove 5231 } = _ref; 5232 const dismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, { 5233 isDismissible: true, 5234 type: 'default' 5235 }); 5236 const nonDismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, { 5237 isDismissible: false, 5238 type: 'default' 5239 }); 5240 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, { 5241 notices: nonDismissibleNotices, 5242 className: "components-editor-notices__pinned" 5243 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, { 5244 notices: dismissibleNotices, 5245 className: "components-editor-notices__dismissible", 5246 onRemove: onRemove 5247 }, (0,external_wp_element_namespaceObject.createElement)(template_validation_notice, null))); 5248 } 5249 /* harmony default export */ var editor_notices = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ 5250 notices: select(external_wp_notices_namespaceObject.store).getNotices() 5251 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 5252 onRemove: dispatch(external_wp_notices_namespaceObject.store).removeNotice 5253 }))])(EditorNotices)); 5254 5255 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js 5256 5257 5258 /** 5259 * External dependencies 5260 */ 5261 5262 /** 5263 * WordPress dependencies 5264 */ 5265 5266 5267 5268 5269 function EditorSnackbars() { 5270 const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []); 5271 const { 5272 removeNotice 5273 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5274 const snackbarNotices = (0,external_lodash_namespaceObject.filter)(notices, { 5275 type: 'snackbar' 5276 }); 5277 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, { 5278 notices: snackbarNotices, 5279 className: "components-editor-notices__snackbar", 5280 onRemove: removeNotice 5281 }); 5282 } 5283 5284 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] 5285 var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 5286 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js 5287 5288 5289 /** 5290 * WordPress dependencies 5291 */ 5292 5293 5294 5295 5296 5297 5298 5299 /** 5300 * Internal dependencies 5301 */ 5302 5303 5304 function EntityRecordItem(_ref) { 5305 let { 5306 record, 5307 checked, 5308 onChange, 5309 closePanel 5310 } = _ref; 5311 const { 5312 name, 5313 kind, 5314 title, 5315 key 5316 } = record; 5317 const parentBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => { 5318 var _blocks$; 5319 5320 // Get entity's blocks. 5321 const { 5322 blocks = [] 5323 } = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block. 5324 5325 const parents = select(external_wp_blockEditor_namespaceObject.store).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId. 5326 5327 return parents[parents.length - 1]; 5328 }, []); // Handle templates that might use default descriptive titles. 5329 5330 const entityRecordTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { 5331 if ('postType' !== kind || 'wp_template' !== name) { 5332 return title; 5333 } 5334 5335 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); 5336 return select(store_store).__experimentalGetTemplateInfo(template).title; 5337 }, [name, kind, title, key]); 5338 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => { 5339 const selectedBlockId = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(); 5340 return selectedBlockId === parentBlockId; 5341 }, [parentBlockId]); 5342 const isSelectedText = isSelected ? (0,external_wp_i18n_namespaceObject.__)('Selected') : (0,external_wp_i18n_namespaceObject.__)('Select'); 5343 const { 5344 selectBlock 5345 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 5346 const selectParentBlock = (0,external_wp_element_namespaceObject.useCallback)(() => selectBlock(parentBlockId), [parentBlockId]); 5347 const selectAndDismiss = (0,external_wp_element_namespaceObject.useCallback)(() => { 5348 selectBlock(parentBlockId); 5349 closePanel(); 5350 }, [parentBlockId]); 5351 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 5352 label: (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled')), 5353 checked: checked, 5354 onChange: onChange 5355 }), parentBlockId ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5356 onClick: selectParentBlock, 5357 className: "entities-saved-states__find-entity", 5358 disabled: isSelected 5359 }, isSelectedText), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5360 onClick: selectAndDismiss, 5361 className: "entities-saved-states__find-entity-small", 5362 disabled: isSelected 5363 }, isSelectedText)) : null); 5364 } 5365 5366 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js 5367 5368 5369 /** 5370 * External dependencies 5371 */ 5372 5373 /** 5374 * WordPress dependencies 5375 */ 5376 5377 5378 5379 5380 5381 /** 5382 * Internal dependencies 5383 */ 5384 5385 5386 5387 function getEntityDescription(entity, count) { 5388 switch (entity) { 5389 case 'site': 5390 return 1 === count ? (0,external_wp_i18n_namespaceObject.__)('This change will affect your whole site.') : (0,external_wp_i18n_namespaceObject.__)('These changes will affect your whole site.'); 5391 5392 case 'wp_template': 5393 return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.'); 5394 5395 case 'page': 5396 case 'post': 5397 return (0,external_wp_i18n_namespaceObject.__)('The following content has been modified.'); 5398 } 5399 } 5400 5401 function EntityTypeList(_ref) { 5402 let { 5403 list, 5404 unselectedEntities, 5405 setUnselectedEntities, 5406 closePanel 5407 } = _ref; 5408 const count = list.length; 5409 const firstRecord = list[0]; 5410 const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); 5411 const { 5412 name 5413 } = firstRecord; 5414 let entityLabel = entityConfig.label; 5415 5416 if (name === 'wp_template_part') { 5417 entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'); 5418 } // Set description based on type of entity. 5419 5420 5421 const description = getEntityDescription(name, count); 5422 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 5423 title: entityLabel, 5424 initialOpen: true 5425 }, description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, description), list.map(record => { 5426 return (0,external_wp_element_namespaceObject.createElement)(EntityRecordItem, { 5427 key: record.key || record.property, 5428 record: record, 5429 checked: !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), 5430 onChange: value => setUnselectedEntities(record, value), 5431 closePanel: closePanel 5432 }); 5433 })); 5434 } 5435 5436 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js 5437 5438 5439 5440 /** 5441 * External dependencies 5442 */ 5443 5444 /** 5445 * WordPress dependencies 5446 */ 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 /** 5457 * Internal dependencies 5458 */ 5459 5460 5461 const TRANSLATED_SITE_PROPERTIES = { 5462 title: (0,external_wp_i18n_namespaceObject.__)('Title'), 5463 description: (0,external_wp_i18n_namespaceObject.__)('Tagline'), 5464 site_logo: (0,external_wp_i18n_namespaceObject.__)('Logo'), 5465 site_icon: (0,external_wp_i18n_namespaceObject.__)('Icon'), 5466 show_on_front: (0,external_wp_i18n_namespaceObject.__)('Show on front'), 5467 page_on_front: (0,external_wp_i18n_namespaceObject.__)('Page on front') 5468 }; 5469 const PUBLISH_ON_SAVE_ENTITIES = [{ 5470 kind: 'postType', 5471 name: 'wp_navigation' 5472 }]; 5473 function EntitiesSavedStates(_ref) { 5474 let { 5475 close 5476 } = _ref; 5477 const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); 5478 const { 5479 dirtyEntityRecords 5480 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5481 const dirtyRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces. 5482 5483 5484 const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site')); 5485 const siteEdits = select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('root', 'site'); 5486 const siteEditsAsEntities = []; 5487 5488 for (const property in siteEdits) { 5489 siteEditsAsEntities.push({ 5490 kind: 'root', 5491 name: 'site', 5492 title: TRANSLATED_SITE_PROPERTIES[property] || property, 5493 property 5494 }); 5495 } 5496 5497 const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities]; 5498 return { 5499 dirtyEntityRecords: dirtyRecordsWithSiteItems 5500 }; 5501 }, []); 5502 const { 5503 editEntityRecord, 5504 saveEditedEntityRecord, 5505 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 5506 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5507 const { 5508 __unstableMarkLastChangeAsPersistent 5509 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 5510 const { 5511 createSuccessNotice, 5512 createErrorNotice 5513 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // To group entities by type. 5514 5515 const partitionedSavables = (0,external_lodash_namespaceObject.groupBy)(dirtyEntityRecords, 'name'); // Sort entity groups. 5516 5517 const { 5518 site: siteSavables, 5519 wp_template: templateSavables, 5520 wp_template_part: templatePartSavables, 5521 ...contentSavables 5522 } = partitionedSavables; 5523 const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); // Unchecked entities to be ignored by save function. 5524 5525 const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); 5526 5527 const setUnselectedEntities = (_ref2, checked) => { 5528 let { 5529 kind, 5530 name, 5531 key, 5532 property 5533 } = _ref2; 5534 5535 if (checked) { 5536 _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); 5537 } else { 5538 _setUnselectedEntities([...unselectedEntities, { 5539 kind, 5540 name, 5541 key, 5542 property 5543 }]); 5544 } 5545 }; 5546 5547 const saveCheckedEntities = () => { 5548 const entitiesToSave = dirtyEntityRecords.filter(_ref3 => { 5549 let { 5550 kind, 5551 name, 5552 key, 5553 property 5554 } = _ref3; 5555 return !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); 5556 }); 5557 close(entitiesToSave); 5558 const siteItemsToSave = []; 5559 const pendingSavedRecords = []; 5560 entitiesToSave.forEach(_ref4 => { 5561 let { 5562 kind, 5563 name, 5564 key, 5565 property 5566 } = _ref4; 5567 5568 if ('root' === kind && 'site' === name) { 5569 siteItemsToSave.push(property); 5570 } else { 5571 if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) { 5572 editEntityRecord(kind, name, key, { 5573 status: 'publish' 5574 }); 5575 } 5576 5577 pendingSavedRecords.push(saveEditedEntityRecord(kind, name, key)); 5578 } 5579 }); 5580 5581 if (siteItemsToSave.length) { 5582 pendingSavedRecords.push(saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave)); 5583 } 5584 5585 __unstableMarkLastChangeAsPersistent(); 5586 5587 Promise.all(pendingSavedRecords).then(values => { 5588 if (values.some(value => typeof value === 'undefined')) { 5589 createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.')); 5590 } else { 5591 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), { 5592 type: 'snackbar' 5593 }); 5594 } 5595 }).catch(error => createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} $error}`)); 5596 }; // Explicitly define this with no argument passed. Using `close` on 5597 // its own will use the event object in place of the expected saved entities. 5598 5599 5600 const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); 5601 const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ 5602 onClose: () => dismissPanel() 5603 }); 5604 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ 5605 ref: saveDialogRef 5606 }, saveDialogProps, { 5607 className: "entities-saved-states__panel" 5608 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 5609 className: "entities-saved-states__panel-header", 5610 gap: 2 5611 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { 5612 isBlock: true, 5613 as: external_wp_components_namespaceObject.Button, 5614 ref: saveButtonRef, 5615 variant: "primary", 5616 disabled: dirtyEntityRecords.length - unselectedEntities.length === 0, 5617 onClick: saveCheckedEntities, 5618 className: "editor-entities-saved-states__save-button" 5619 }, (0,external_wp_i18n_namespaceObject.__)('Save')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { 5620 isBlock: true, 5621 as: external_wp_components_namespaceObject.Button, 5622 variant: "secondary", 5623 onClick: dismissPanel 5624 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)("div", { 5625 className: "entities-saved-states__text-prompt" 5626 }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => { 5627 return (0,external_wp_element_namespaceObject.createElement)(EntityTypeList, { 5628 key: list[0].name, 5629 list: list, 5630 closePanel: dismissPanel, 5631 unselectedEntities: unselectedEntities, 5632 setUnselectedEntities: setUnselectedEntities 5633 }); 5634 })); 5635 } 5636 5637 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js 5638 5639 5640 /** 5641 * WordPress dependencies 5642 */ 5643 5644 5645 5646 5647 5648 5649 /** 5650 * Internal dependencies 5651 */ 5652 5653 5654 5655 function CopyButton(_ref) { 5656 let { 5657 text, 5658 children 5659 } = _ref; 5660 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 5661 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5662 variant: "secondary", 5663 ref: ref 5664 }, children); 5665 } 5666 5667 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 5668 constructor() { 5669 super(...arguments); 5670 this.reboot = this.reboot.bind(this); 5671 this.getContent = this.getContent.bind(this); 5672 this.state = { 5673 error: null 5674 }; 5675 } 5676 5677 componentDidCatch(error) { 5678 this.setState({ 5679 error 5680 }); 5681 } 5682 5683 reboot() { 5684 this.props.onError(); 5685 } 5686 5687 getContent() { 5688 try { 5689 // While `select` in a component is generally discouraged, it is 5690 // used here because it (a) reduces the chance of data loss in the 5691 // case of additional errors by performing a direct retrieval and 5692 // (b) avoids the performance cost associated with unnecessary 5693 // content serialization throughout the lifetime of a non-erroring 5694 // application. 5695 return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); 5696 } catch (error) {} 5697 } 5698 5699 render() { 5700 const { 5701 error 5702 } = this.state; 5703 5704 if (!error) { 5705 return this.props.children; 5706 } 5707 5708 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { 5709 className: "editor-error-boundary", 5710 actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5711 key: "recovery", 5712 onClick: this.reboot, 5713 variant: "secondary" 5714 }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, { 5715 key: "copy-post", 5716 text: this.getContent 5717 }, (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, { 5718 key: "copy-error", 5719 text: error.stack 5720 }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))] 5721 }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')); 5722 } 5723 5724 } 5725 5726 /* harmony default export */ var error_boundary = (ErrorBoundary); 5727 5728 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js 5729 5730 5731 /** 5732 * External dependencies 5733 */ 5734 5735 /** 5736 * WordPress dependencies 5737 */ 5738 5739 5740 5741 5742 5743 5744 5745 /** 5746 * Internal dependencies 5747 */ 5748 5749 5750 5751 5752 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; 5753 /** 5754 * Function which returns true if the current environment supports browser 5755 * sessionStorage, or false otherwise. The result of this function is cached and 5756 * reused in subsequent invocations. 5757 */ 5758 5759 const hasSessionStorageSupport = (0,external_lodash_namespaceObject.once)(() => { 5760 try { 5761 // Private Browsing in Safari 10 and earlier will throw an error when 5762 // attempting to set into sessionStorage. The test here is intentional in 5763 // causing a thrown error as condition bailing from local autosave. 5764 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); 5765 window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); 5766 return true; 5767 } catch (error) { 5768 return false; 5769 } 5770 }); 5771 /** 5772 * Custom hook which manages the creation of a notice prompting the user to 5773 * restore a local autosave, if one exists. 5774 */ 5775 5776 function useAutosaveNotice() { 5777 const { 5778 postId, 5779 isEditedPostNew, 5780 hasRemoteAutosave 5781 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 5782 postId: select(store_store).getCurrentPostId(), 5783 isEditedPostNew: select(store_store).isEditedPostNew(), 5784 hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave 5785 }), []); 5786 const { 5787 getEditedPostAttribute 5788 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 5789 const { 5790 createWarningNotice, 5791 removeNotice 5792 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5793 const { 5794 editPost, 5795 resetEditorBlocks 5796 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5797 (0,external_wp_element_namespaceObject.useEffect)(() => { 5798 let localAutosave = localAutosaveGet(postId, isEditedPostNew); 5799 5800 if (!localAutosave) { 5801 return; 5802 } 5803 5804 try { 5805 localAutosave = JSON.parse(localAutosave); 5806 } catch (error) { 5807 // Not usable if it can't be parsed. 5808 return; 5809 } 5810 5811 const { 5812 post_title: title, 5813 content, 5814 excerpt 5815 } = localAutosave; 5816 const edits = { 5817 title, 5818 content, 5819 excerpt 5820 }; 5821 { 5822 // Only display a notice if there is a difference between what has been 5823 // saved and that which is stored in sessionStorage. 5824 const hasDifference = Object.keys(edits).some(key => { 5825 return edits[key] !== getEditedPostAttribute(key); 5826 }); 5827 5828 if (!hasDifference) { 5829 // If there is no difference, it can be safely ejected from storage. 5830 localAutosaveClear(postId, isEditedPostNew); 5831 return; 5832 } 5833 } 5834 5835 if (hasRemoteAutosave) { 5836 return; 5837 } 5838 5839 const noticeId = (0,external_lodash_namespaceObject.uniqueId)('wpEditorAutosaveRestore'); 5840 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), { 5841 id: noticeId, 5842 actions: [{ 5843 label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'), 5844 5845 onClick() { 5846 editPost((0,external_lodash_namespaceObject.omit)(edits, ['content'])); 5847 resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); 5848 removeNotice(noticeId); 5849 } 5850 5851 }] 5852 }); 5853 }, [isEditedPostNew, postId]); 5854 } 5855 /** 5856 * Custom hook which ejects a local autosave after a successful save occurs. 5857 */ 5858 5859 5860 function useAutosavePurge() { 5861 const { 5862 postId, 5863 isEditedPostNew, 5864 isDirty, 5865 isAutosaving, 5866 didError 5867 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 5868 postId: select(store_store).getCurrentPostId(), 5869 isEditedPostNew: select(store_store).isEditedPostNew(), 5870 isDirty: select(store_store).isEditedPostDirty(), 5871 isAutosaving: select(store_store).isAutosavingPost(), 5872 didError: select(store_store).didPostSaveRequestFail() 5873 }), []); 5874 const lastIsDirty = (0,external_wp_element_namespaceObject.useRef)(isDirty); 5875 const lastIsAutosaving = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); 5876 (0,external_wp_element_namespaceObject.useEffect)(() => { 5877 if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) { 5878 localAutosaveClear(postId, isEditedPostNew); 5879 } 5880 5881 lastIsDirty.current = isDirty; 5882 lastIsAutosaving.current = isAutosaving; 5883 }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. 5884 5885 const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); 5886 const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); 5887 (0,external_wp_element_namespaceObject.useEffect)(() => { 5888 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { 5889 localAutosaveClear(postId, true); 5890 } 5891 }, [isEditedPostNew, postId]); 5892 } 5893 5894 function LocalAutosaveMonitor() { 5895 const { 5896 autosave 5897 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5898 const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { 5899 requestIdleCallback(() => autosave({ 5900 local: true 5901 })); 5902 }, []); 5903 useAutosaveNotice(); 5904 useAutosavePurge(); 5905 const { 5906 localAutosaveInterval 5907 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 5908 localAutosaveInterval: select(store_store).getEditorSettings().localAutosaveInterval 5909 }), []); 5910 return (0,external_wp_element_namespaceObject.createElement)(autosave_monitor, { 5911 interval: localAutosaveInterval, 5912 autosave: deferredAutosave 5913 }); 5914 } 5915 5916 /* harmony default export */ var local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor)); 5917 5918 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js 5919 /** 5920 * External dependencies 5921 */ 5922 5923 /** 5924 * WordPress dependencies 5925 */ 5926 5927 5928 5929 /** 5930 * Internal dependencies 5931 */ 5932 5933 5934 function PageAttributesCheck(_ref) { 5935 let { 5936 children 5937 } = _ref; 5938 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { 5939 const { 5940 getEditedPostAttribute 5941 } = select(store_store); 5942 const { 5943 getPostType 5944 } = select(external_wp_coreData_namespaceObject.store); 5945 return getPostType(getEditedPostAttribute('type')); 5946 }, []); 5947 const supportsPageAttributes = (0,external_lodash_namespaceObject.get)(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. 5948 5949 if (!supportsPageAttributes) { 5950 return null; 5951 } 5952 5953 return children; 5954 } 5955 /* harmony default export */ var page_attributes_check = (PageAttributesCheck); 5956 5957 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js 5958 /** 5959 * External dependencies 5960 */ 5961 5962 /** 5963 * WordPress dependencies 5964 */ 5965 5966 5967 5968 /** 5969 * Internal dependencies 5970 */ 5971 5972 5973 /** 5974 * A component which renders its own children only if the current editor post 5975 * type supports one of the given `supportKeys` prop. 5976 * 5977 * @param {Object} props Props. 5978 * @param {string} [props.postType] Current post type. 5979 * @param {WPElement} props.children Children to be rendered if post 5980 * type supports. 5981 * @param {(string|string[])} props.supportKeys String or string array of keys 5982 * to test. 5983 * 5984 * @return {WPComponent} The component to be rendered. 5985 */ 5986 5987 function PostTypeSupportCheck(_ref) { 5988 let { 5989 postType, 5990 children, 5991 supportKeys 5992 } = _ref; 5993 let isSupported = true; 5994 5995 if (postType) { 5996 isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => !!postType.supports[key]); 5997 } 5998 5999 if (!isSupported) { 6000 return null; 6001 } 6002 6003 return children; 6004 } 6005 /* harmony default export */ var post_type_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { 6006 const { 6007 getEditedPostAttribute 6008 } = select(store_store); 6009 const { 6010 getPostType 6011 } = select(external_wp_coreData_namespaceObject.store); 6012 return { 6013 postType: getPostType(getEditedPostAttribute('type')) 6014 }; 6015 })(PostTypeSupportCheck)); 6016 6017 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js 6018 6019 6020 /** 6021 * External dependencies 6022 */ 6023 6024 /** 6025 * WordPress dependencies 6026 */ 6027 6028 6029 6030 6031 6032 6033 /** 6034 * Internal dependencies 6035 */ 6036 6037 6038 6039 const PageAttributesOrder = _ref => { 6040 let { 6041 onUpdateOrder, 6042 order = 0 6043 } = _ref; 6044 const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); 6045 6046 const setUpdatedOrder = value => { 6047 setOrderInput(value); 6048 const newOrder = Number(value); 6049 6050 if (Number.isInteger(newOrder) && (0,external_lodash_namespaceObject.invoke)(value, ['trim']) !== '') { 6051 onUpdateOrder(Number(value)); 6052 } 6053 }; 6054 6055 const value = orderInput === null ? order : orderInput; 6056 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 6057 className: "editor-page-attributes__order", 6058 type: "number", 6059 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 6060 value: value, 6061 onChange: setUpdatedOrder, 6062 size: 6, 6063 onBlur: () => { 6064 setOrderInput(null); 6065 } 6066 }); 6067 }; 6068 6069 function PageAttributesOrderWithChecks(props) { 6070 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { 6071 supportKeys: "page-attributes" 6072 }, (0,external_wp_element_namespaceObject.createElement)(PageAttributesOrder, props)); 6073 } 6074 6075 /* harmony default export */ var order = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 6076 return { 6077 order: select(store_store).getEditedPostAttribute('menu_order') 6078 }; 6079 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 6080 onUpdateOrder(order) { 6081 dispatch(store_store).editPost({ 6082 menu_order: order 6083 }); 6084 } 6085 6086 }))])(PageAttributesOrderWithChecks)); 6087 6088 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js 6089 /** 6090 * External dependencies 6091 */ 6092 6093 /** 6094 * Returns terms in a tree form. 6095 * 6096 * @param {Array} flatTerms Array of terms in flat format. 6097 * 6098 * @return {Array} Array of terms in tree format. 6099 */ 6100 6101 function buildTermsTree(flatTerms) { 6102 const flatTermsWithParentAndChildren = flatTerms.map(term => { 6103 return { 6104 children: [], 6105 parent: null, 6106 ...term 6107 }; 6108 }); 6109 const termsByParent = (0,external_lodash_namespaceObject.groupBy)(flatTermsWithParentAndChildren, 'parent'); 6110 6111 if (termsByParent.null && termsByParent.null.length) { 6112 return flatTermsWithParentAndChildren; 6113 } 6114 6115 const fillWithChildren = terms => { 6116 return terms.map(term => { 6117 const children = termsByParent[term.id]; 6118 return { ...term, 6119 children: children && children.length ? fillWithChildren(children) : [] 6120 }; 6121 }); 6122 }; 6123 6124 return fillWithChildren(termsByParent['0'] || []); 6125 } // Lodash unescape function handles ' but not ' which may be return in some API requests. 6126 6127 const unescapeString = arg => { 6128 return (0,external_lodash_namespaceObject.unescape)(arg.replace(''', "'")); 6129 }; 6130 /** 6131 * Returns a term object with name unescaped. 6132 * The unescape of the name property is done using lodash unescape function. 6133 * 6134 * @param {Object} term The term object to unescape. 6135 * 6136 * @return {Object} Term object with name property unescaped. 6137 */ 6138 6139 const unescapeTerm = term => { 6140 return { ...term, 6141 name: unescapeString(term.name) 6142 }; 6143 }; 6144 /** 6145 * Returns an array of term objects with names unescaped. 6146 * The unescape of each term is performed using the unescapeTerm function. 6147 * 6148 * @param {Object[]} terms Array of term objects to unescape. 6149 * 6150 * @return {Object[]} Array of term objects unescaped. 6151 */ 6152 6153 const unescapeTerms = terms => { 6154 return (0,external_lodash_namespaceObject.map)(terms, unescapeTerm); 6155 }; 6156 6157 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js 6158 6159 6160 /** 6161 * External dependencies 6162 */ 6163 6164 /** 6165 * WordPress dependencies 6166 */ 6167 6168 6169 6170 6171 6172 6173 6174 /** 6175 * Internal dependencies 6176 */ 6177 6178 6179 6180 6181 function getTitle(post) { 6182 var _post$title; 6183 6184 return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#$post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; 6185 } 6186 6187 const getItemPriority = (name, searchValue) => { 6188 const normalizedName = (0,external_lodash_namespaceObject.deburr)(name).toLowerCase(); 6189 const normalizedSearch = (0,external_lodash_namespaceObject.deburr)(searchValue).toLowerCase(); 6190 6191 if (normalizedName === normalizedSearch) { 6192 return 0; 6193 } 6194 6195 if (normalizedName.startsWith(normalizedSearch)) { 6196 return normalizedName.length; 6197 } 6198 6199 return Infinity; 6200 }; 6201 function PageAttributesParent() { 6202 const { 6203 editPost 6204 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6205 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); 6206 const { 6207 parentPost, 6208 parentPostId, 6209 items, 6210 postType 6211 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6212 const { 6213 getPostType, 6214 getEntityRecords, 6215 getEntityRecord 6216 } = select(external_wp_coreData_namespaceObject.store); 6217 const { 6218 getCurrentPostId, 6219 getEditedPostAttribute 6220 } = select(store_store); 6221 const postTypeSlug = getEditedPostAttribute('type'); 6222 const pageId = getEditedPostAttribute('parent'); 6223 const pType = getPostType(postTypeSlug); 6224 const postId = getCurrentPostId(); 6225 const isHierarchical = (0,external_lodash_namespaceObject.get)(pType, ['hierarchical'], false); 6226 const query = { 6227 per_page: 100, 6228 exclude: postId, 6229 parent_exclude: postId, 6230 orderby: 'menu_order', 6231 order: 'asc', 6232 _fields: 'id,title,parent' 6233 }; // Perform a search when the field is changed. 6234 6235 if (!!fieldValue) { 6236 query.search = fieldValue; 6237 } 6238 6239 return { 6240 parentPostId: pageId, 6241 parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null, 6242 items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [], 6243 postType: pType 6244 }; 6245 }, [fieldValue]); 6246 const isHierarchical = (0,external_lodash_namespaceObject.get)(postType, ['hierarchical'], false); 6247 const parentPageLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'parent_item_colon']); 6248 const pageItems = items || []; 6249 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 6250 const getOptionsFromTree = function (tree) { 6251 let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 6252 const mappedNodes = tree.map(treeNode => [{ 6253 value: treeNode.id, 6254 label: (0,external_lodash_namespaceObject.repeat)('— ', level) + (0,external_lodash_namespaceObject.unescape)(treeNode.name), 6255 rawName: treeNode.name 6256 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); 6257 const sortedNodes = mappedNodes.sort((_ref, _ref2) => { 6258 let [a] = _ref; 6259 let [b] = _ref2; 6260 const priorityA = getItemPriority(a.rawName, fieldValue); 6261 const priorityB = getItemPriority(b.rawName, fieldValue); 6262 return priorityA >= priorityB ? 1 : -1; 6263 }); 6264 return (0,external_lodash_namespaceObject.flatten)(sortedNodes); 6265 }; 6266 6267 let tree = pageItems.map(item => ({ 6268 id: item.id, 6269 parent: item.parent, 6270 name: getTitle(item) 6271 })); // Only build a hierarchical tree when not searching. 6272 6273 if (!fieldValue) { 6274 tree = buildTermsTree(tree); 6275 } 6276 6277 const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list. 6278 6279 const optsHasParent = (0,external_lodash_namespaceObject.find)(opts, item => item.value === parentPostId); 6280 6281 if (parentPost && !optsHasParent) { 6282 opts.unshift({ 6283 value: parentPostId, 6284 label: getTitle(parentPost) 6285 }); 6286 } 6287 6288 return opts; 6289 }, [pageItems, fieldValue]); 6290 6291 if (!isHierarchical || !parentPageLabel) { 6292 return null; 6293 } 6294 /** 6295 * Handle user input. 6296 * 6297 * @param {string} inputValue The current value of the input field. 6298 */ 6299 6300 6301 const handleKeydown = inputValue => { 6302 setFieldValue(inputValue); 6303 }; 6304 /** 6305 * Handle author selection. 6306 * 6307 * @param {Object} selectedPostId The selected Author. 6308 */ 6309 6310 6311 const handleChange = selectedPostId => { 6312 editPost({ 6313 parent: selectedPostId 6314 }); 6315 }; 6316 6317 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, { 6318 className: "editor-page-attributes__parent", 6319 label: parentPageLabel, 6320 value: parentPostId, 6321 options: parentOptions, 6322 onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300), 6323 onChange: handleChange 6324 }); 6325 } 6326 /* harmony default export */ var page_attributes_parent = (PageAttributesParent); 6327 6328 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js 6329 6330 6331 /** 6332 * External dependencies 6333 */ 6334 6335 /** 6336 * WordPress dependencies 6337 */ 6338 6339 6340 6341 6342 6343 /** 6344 * Internal dependencies 6345 */ 6346 6347 6348 function PostTemplate(_ref) { 6349 let {} = _ref; 6350 const { 6351 availableTemplates, 6352 selectedTemplate, 6353 isViewable 6354 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6355 var _getPostType$viewable, _getPostType; 6356 6357 const { 6358 getEditedPostAttribute, 6359 getEditorSettings, 6360 getCurrentPostType 6361 } = select(store_store); 6362 const { 6363 getPostType 6364 } = select(external_wp_coreData_namespaceObject.store); 6365 return { 6366 selectedTemplate: getEditedPostAttribute('template'), 6367 availableTemplates: getEditorSettings().availableTemplates, 6368 isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false 6369 }; 6370 }, []); 6371 const { 6372 editPost 6373 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6374 6375 if (!isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates)) { 6376 return null; 6377 } 6378 6379 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { 6380 label: (0,external_wp_i18n_namespaceObject.__)('Template:'), 6381 value: selectedTemplate, 6382 onChange: templateSlug => { 6383 editPost({ 6384 template: templateSlug || '' 6385 }); 6386 }, 6387 options: (0,external_lodash_namespaceObject.map)(availableTemplates, (templateName, templateSlug) => ({ 6388 value: templateSlug, 6389 label: templateName 6390 })) 6391 }); 6392 } 6393 /* harmony default export */ var post_template = (PostTemplate); 6394 6395 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js 6396 const AUTHORS_QUERY = { 6397 who: 'authors', 6398 per_page: 50, 6399 _fields: 'id,name', 6400 context: 'view' // Allows non-admins to perform requests. 6401 6402 }; 6403 6404 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js 6405 6406 6407 /** 6408 * External dependencies 6409 */ 6410 6411 /** 6412 * WordPress dependencies 6413 */ 6414 6415 6416 6417 6418 6419 6420 6421 /** 6422 * Internal dependencies 6423 */ 6424 6425 6426 6427 6428 function PostAuthorCombobox() { 6429 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); 6430 const { 6431 authorId, 6432 isLoading, 6433 authors, 6434 postAuthor 6435 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6436 const { 6437 getUser, 6438 getUsers, 6439 isResolving 6440 } = select(external_wp_coreData_namespaceObject.store); 6441 const { 6442 getEditedPostAttribute 6443 } = select(store_store); 6444 const author = getUser(getEditedPostAttribute('author'), { 6445 context: 'view' 6446 }); 6447 const query = { ...AUTHORS_QUERY 6448 }; 6449 6450 if (fieldValue) { 6451 query.search = fieldValue; 6452 } 6453 6454 return { 6455 authorId: getEditedPostAttribute('author'), 6456 postAuthor: author, 6457 authors: getUsers(query), 6458 isLoading: isResolving('core', 'getUsers', [query]) 6459 }; 6460 }, [fieldValue]); 6461 const { 6462 editPost 6463 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6464 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 6465 const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { 6466 return { 6467 value: author.id, 6468 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) 6469 }; 6470 }); // Ensure the current author is included in the dropdown list. 6471 6472 const foundAuthor = fetchedAuthors.findIndex(_ref => { 6473 let { 6474 value 6475 } = _ref; 6476 return (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value; 6477 }); 6478 6479 if (foundAuthor < 0 && postAuthor) { 6480 return [{ 6481 value: postAuthor.id, 6482 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) 6483 }, ...fetchedAuthors]; 6484 } 6485 6486 return fetchedAuthors; 6487 }, [authors, postAuthor]); 6488 /** 6489 * Handle author selection. 6490 * 6491 * @param {number} postAuthorId The selected Author. 6492 */ 6493 6494 const handleSelect = postAuthorId => { 6495 if (!postAuthorId) { 6496 return; 6497 } 6498 6499 editPost({ 6500 author: postAuthorId 6501 }); 6502 }; 6503 /** 6504 * Handle user input. 6505 * 6506 * @param {string} inputValue The current value of the input field. 6507 */ 6508 6509 6510 const handleKeydown = inputValue => { 6511 setFieldValue(inputValue); 6512 }; 6513 6514 if (!postAuthor) { 6515 return null; 6516 } 6517 6518 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, { 6519 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 6520 options: authorOptions, 6521 value: authorId, 6522 onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300), 6523 onChange: handleSelect, 6524 isLoading: isLoading, 6525 allowReset: false 6526 }); 6527 } 6528 6529 /* harmony default export */ var combobox = (PostAuthorCombobox); 6530 6531 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js 6532 6533 6534 /** 6535 * WordPress dependencies 6536 */ 6537 6538 6539 6540 6541 6542 6543 /** 6544 * Internal dependencies 6545 */ 6546 6547 6548 6549 6550 function PostAuthorSelect() { 6551 const { 6552 editPost 6553 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6554 const { 6555 postAuthor, 6556 authors 6557 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6558 return { 6559 postAuthor: select(store_store).getEditedPostAttribute('author'), 6560 authors: select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY) 6561 }; 6562 }, []); 6563 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 6564 return (authors !== null && authors !== void 0 ? authors : []).map(author => { 6565 return { 6566 value: author.id, 6567 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) 6568 }; 6569 }); 6570 }, [authors]); 6571 6572 const setAuthorId = value => { 6573 const author = Number(value); 6574 editPost({ 6575 author 6576 }); 6577 }; 6578 6579 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { 6580 className: "post-author-selector", 6581 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 6582 options: authorOptions, 6583 onChange: setAuthorId, 6584 value: postAuthor 6585 }); 6586 } 6587 6588 /* harmony default export */ var post_author_select = (PostAuthorSelect); 6589 6590 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js 6591 6592 6593 /** 6594 * WordPress dependencies 6595 */ 6596 6597 6598 /** 6599 * Internal dependencies 6600 */ 6601 6602 6603 6604 6605 const minimumUsersForCombobox = 25; 6606 6607 function PostAuthor() { 6608 const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => { 6609 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 6610 return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox; 6611 }, []); 6612 6613 if (showCombobox) { 6614 return (0,external_wp_element_namespaceObject.createElement)(combobox, null); 6615 } 6616 6617 return (0,external_wp_element_namespaceObject.createElement)(post_author_select, null); 6618 } 6619 6620 /* harmony default export */ var post_author = (PostAuthor); 6621 6622 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js 6623 6624 6625 /** 6626 * External dependencies 6627 */ 6628 6629 /** 6630 * WordPress dependencies 6631 */ 6632 6633 6634 6635 /** 6636 * Internal dependencies 6637 */ 6638 6639 6640 6641 6642 function PostAuthorCheck(_ref) { 6643 let { 6644 children 6645 } = _ref; 6646 const { 6647 hasAssignAuthorAction, 6648 hasAuthors 6649 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6650 const post = select(store_store).getCurrentPost(); 6651 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 6652 return { 6653 hasAssignAuthorAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-author'], false), 6654 hasAuthors: (authors === null || authors === void 0 ? void 0 : authors.length) >= 1 6655 }; 6656 }, []); 6657 6658 if (!hasAssignAuthorAction || !hasAuthors) { 6659 return null; 6660 } 6661 6662 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { 6663 supportKeys: "author" 6664 }, children); 6665 } 6666 6667 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js 6668 6669 6670 /** 6671 * WordPress dependencies 6672 */ 6673 6674 6675 6676 6677 /** 6678 * Internal dependencies 6679 */ 6680 6681 6682 6683 function PostComments(_ref) { 6684 let { 6685 commentStatus = 'open', 6686 ...props 6687 } = _ref; 6688 6689 const onToggleComments = () => props.editPost({ 6690 comment_status: commentStatus === 'open' ? 'closed' : 'open' 6691 }); 6692 6693 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 6694 label: (0,external_wp_i18n_namespaceObject.__)('Allow comments'), 6695 checked: commentStatus === 'open', 6696 onChange: onToggleComments 6697 }); 6698 } 6699 6700 /* harmony default export */ var post_comments = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 6701 return { 6702 commentStatus: select(store_store).getEditedPostAttribute('comment_status') 6703 }; 6704 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 6705 editPost: dispatch(store_store).editPost 6706 }))])(PostComments)); 6707 6708 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js 6709 6710 6711 /** 6712 * WordPress dependencies 6713 */ 6714 6715 6716 6717 6718 /** 6719 * Internal dependencies 6720 */ 6721 6722 6723 6724 function PostExcerpt(_ref) { 6725 let { 6726 excerpt, 6727 onUpdateExcerpt 6728 } = _ref; 6729 return (0,external_wp_element_namespaceObject.createElement)("div", { 6730 className: "editor-post-excerpt" 6731 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, { 6732 label: (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'), 6733 className: "editor-post-excerpt__textarea", 6734 onChange: value => onUpdateExcerpt(value), 6735 value: excerpt 6736 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 6737 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/settings-sidebar/#excerpt') 6738 }, (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts'))); 6739 } 6740 6741 /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 6742 return { 6743 excerpt: select(store_store).getEditedPostAttribute('excerpt') 6744 }; 6745 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 6746 onUpdateExcerpt(excerpt) { 6747 dispatch(store_store).editPost({ 6748 excerpt 6749 }); 6750 } 6751 6752 }))])(PostExcerpt)); 6753 6754 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js 6755 6756 6757 6758 /** 6759 * Internal dependencies 6760 */ 6761 6762 6763 function PostExcerptCheck(props) { 6764 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, { 6765 supportKeys: "excerpt" 6766 })); 6767 } 6768 6769 /* harmony default export */ var post_excerpt_check = (PostExcerptCheck); 6770 6771 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js 6772 /** 6773 * External dependencies 6774 */ 6775 6776 /** 6777 * WordPress dependencies 6778 */ 6779 6780 6781 6782 /** 6783 * Internal dependencies 6784 */ 6785 6786 6787 function ThemeSupportCheck(_ref) { 6788 let { 6789 themeSupports, 6790 children, 6791 postType, 6792 supportKeys 6793 } = _ref; 6794 const isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => { 6795 const supported = (0,external_lodash_namespaceObject.get)(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. 6796 // In the latter case, we need to verify `postType` exists 6797 // within `supported`. If `postType` isn't passed, then the check 6798 // should fail. 6799 6800 if ('post-thumbnails' === key && (0,external_lodash_namespaceObject.isArray)(supported)) { 6801 return (0,external_lodash_namespaceObject.includes)(supported, postType); 6802 } 6803 6804 return supported; 6805 }); 6806 6807 if (!isSupported) { 6808 return null; 6809 } 6810 6811 return children; 6812 } 6813 /* harmony default export */ var theme_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { 6814 const { 6815 getThemeSupports 6816 } = select(external_wp_coreData_namespaceObject.store); 6817 const { 6818 getEditedPostAttribute 6819 } = select(store_store); 6820 return { 6821 postType: getEditedPostAttribute('type'), 6822 themeSupports: getThemeSupports() 6823 }; 6824 })(ThemeSupportCheck)); 6825 6826 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js 6827 6828 6829 6830 /** 6831 * Internal dependencies 6832 */ 6833 6834 6835 6836 function PostFeaturedImageCheck(props) { 6837 return (0,external_wp_element_namespaceObject.createElement)(theme_support_check, { 6838 supportKeys: "post-thumbnails" 6839 }, (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, { 6840 supportKeys: "thumbnail" 6841 }))); 6842 } 6843 6844 /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); 6845 6846 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js 6847 6848 6849 /** 6850 * External dependencies 6851 */ 6852 6853 /** 6854 * WordPress dependencies 6855 */ 6856 6857 6858 6859 6860 6861 6862 6863 6864 /** 6865 * Internal dependencies 6866 */ 6867 6868 6869 6870 const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. 6871 6872 const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image'); 6873 6874 const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Set featured image'); 6875 6876 const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Remove image'); 6877 6878 function PostFeaturedImage(_ref) { 6879 var _media$media_details$, _media$media_details$2; 6880 6881 let { 6882 currentPostId, 6883 featuredImageId, 6884 onUpdateImage, 6885 onDropImage, 6886 onRemoveImage, 6887 media, 6888 postType, 6889 noticeUI 6890 } = _ref; 6891 const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels'], {}); 6892 const instructions = (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.')); 6893 let mediaWidth, mediaHeight, mediaSourceUrl; 6894 6895 if (media) { 6896 const mediaSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); 6897 6898 if ((0,external_lodash_namespaceObject.has)(media, ['media_details', 'sizes', mediaSize])) { 6899 // Use mediaSize when available. 6900 mediaWidth = media.media_details.sizes[mediaSize].width; 6901 mediaHeight = media.media_details.sizes[mediaSize].height; 6902 mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; 6903 } else { 6904 // Get fallbackMediaSize if mediaSize is not available. 6905 const fallbackMediaSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId); 6906 6907 if ((0,external_lodash_namespaceObject.has)(media, ['media_details', 'sizes', fallbackMediaSize])) { 6908 // Use fallbackMediaSize when mediaSize is not available. 6909 mediaWidth = media.media_details.sizes[fallbackMediaSize].width; 6910 mediaHeight = media.media_details.sizes[fallbackMediaSize].height; 6911 mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url; 6912 } else { 6913 // Use full image size when mediaFallbackSize and mediaSize are not available. 6914 mediaWidth = media.media_details.width; 6915 mediaHeight = media.media_details.height; 6916 mediaSourceUrl = media.source_url; 6917 } 6918 } 6919 } 6920 6921 return (0,external_wp_element_namespaceObject.createElement)(post_featured_image_check, null, noticeUI, (0,external_wp_element_namespaceObject.createElement)("div", { 6922 className: "editor-post-featured-image" 6923 }, media && (0,external_wp_element_namespaceObject.createElement)("div", { 6924 id: `editor-post-featured-image-$featuredImageId}-describedby`, 6925 className: "hidden" 6926 }, media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image alt text. 6927 (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image filename. 6928 (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { 6929 fallback: instructions 6930 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, { 6931 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 6932 onSelect: onUpdateImage, 6933 unstableFeaturedImageFlow: true, 6934 allowedTypes: ALLOWED_MEDIA_TYPES, 6935 modalClass: "editor-post-featured-image__media-modal", 6936 render: _ref2 => { 6937 let { 6938 open 6939 } = _ref2; 6940 return (0,external_wp_element_namespaceObject.createElement)("div", { 6941 className: "editor-post-featured-image__container" 6942 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6943 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', 6944 onClick: open, 6945 "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or update the image'), 6946 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-$featuredImageId}-describedby` 6947 }, !!featuredImageId && media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResponsiveWrapper, { 6948 naturalWidth: mediaWidth, 6949 naturalHeight: mediaHeight, 6950 isInline: true 6951 }, (0,external_wp_element_namespaceObject.createElement)("img", { 6952 src: mediaSourceUrl, 6953 alt: "" 6954 })), !!featuredImageId && !media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, { 6955 onFilesDrop: onDropImage 6956 })); 6957 }, 6958 value: featuredImageId 6959 })), !!featuredImageId && media && !media.isLoading && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, { 6960 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 6961 onSelect: onUpdateImage, 6962 unstableFeaturedImageFlow: true, 6963 allowedTypes: ALLOWED_MEDIA_TYPES, 6964 modalClass: "editor-post-featured-image__media-modal", 6965 render: _ref3 => { 6966 let { 6967 open 6968 } = _ref3; 6969 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6970 onClick: open, 6971 variant: "secondary" 6972 }, (0,external_wp_i18n_namespaceObject.__)('Replace Image')); 6973 } 6974 })), !!featuredImageId && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6975 onClick: onRemoveImage, 6976 variant: "link", 6977 isDestructive: true 6978 }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL)))); 6979 } 6980 6981 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { 6982 const { 6983 getMedia, 6984 getPostType 6985 } = select(external_wp_coreData_namespaceObject.store); 6986 const { 6987 getCurrentPostId, 6988 getEditedPostAttribute 6989 } = select(store_store); 6990 const featuredImageId = getEditedPostAttribute('featured_media'); 6991 return { 6992 media: featuredImageId ? getMedia(featuredImageId, { 6993 context: 'view' 6994 }) : null, 6995 currentPostId: getCurrentPostId(), 6996 postType: getPostType(getEditedPostAttribute('type')), 6997 featuredImageId 6998 }; 6999 }); 7000 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref4, _ref5) => { 7001 let { 7002 noticeOperations 7003 } = _ref4; 7004 let { 7005 select 7006 } = _ref5; 7007 const { 7008 editPost 7009 } = dispatch(store_store); 7010 return { 7011 onUpdateImage(image) { 7012 editPost({ 7013 featured_media: image.id 7014 }); 7015 }, 7016 7017 onDropImage(filesList) { 7018 select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ 7019 allowedTypes: ['image'], 7020 filesList, 7021 7022 onFileChange(_ref6) { 7023 let [image] = _ref6; 7024 editPost({ 7025 featured_media: image.id 7026 }); 7027 }, 7028 7029 onError(message) { 7030 noticeOperations.removeAllNotices(); 7031 noticeOperations.createErrorNotice(message); 7032 } 7033 7034 }); 7035 }, 7036 7037 onRemoveImage() { 7038 editPost({ 7039 featured_media: 0 7040 }); 7041 } 7042 7043 }; 7044 }); 7045 /* harmony default export */ var post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage)); 7046 7047 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js 7048 7049 7050 7051 /** 7052 * WordPress dependencies 7053 */ 7054 7055 /** 7056 * Internal dependencies 7057 */ 7058 7059 7060 7061 7062 function PostFormatCheck(_ref) { 7063 let { 7064 disablePostFormats, 7065 ...props 7066 } = _ref; 7067 return !disablePostFormats && (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, { 7068 supportKeys: "post-formats" 7069 })); 7070 } 7071 7072 /* harmony default export */ var post_format_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { 7073 const editorSettings = select(store_store).getEditorSettings(); 7074 return { 7075 disablePostFormats: editorSettings.disablePostFormats 7076 }; 7077 })(PostFormatCheck)); 7078 7079 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js 7080 7081 7082 /** 7083 * External dependencies 7084 */ 7085 7086 /** 7087 * WordPress dependencies 7088 */ 7089 7090 7091 7092 7093 7094 7095 /** 7096 * Internal dependencies 7097 */ 7098 7099 7100 // All WP post formats, sorted alphabetically by translated name. 7101 7102 const POST_FORMATS = [{ 7103 id: 'aside', 7104 caption: (0,external_wp_i18n_namespaceObject.__)('Aside') 7105 }, { 7106 id: 'audio', 7107 caption: (0,external_wp_i18n_namespaceObject.__)('Audio') 7108 }, { 7109 id: 'chat', 7110 caption: (0,external_wp_i18n_namespaceObject.__)('Chat') 7111 }, { 7112 id: 'gallery', 7113 caption: (0,external_wp_i18n_namespaceObject.__)('Gallery') 7114 }, { 7115 id: 'image', 7116 caption: (0,external_wp_i18n_namespaceObject.__)('Image') 7117 }, { 7118 id: 'link', 7119 caption: (0,external_wp_i18n_namespaceObject.__)('Link') 7120 }, { 7121 id: 'quote', 7122 caption: (0,external_wp_i18n_namespaceObject.__)('Quote') 7123 }, { 7124 id: 'standard', 7125 caption: (0,external_wp_i18n_namespaceObject.__)('Standard') 7126 }, { 7127 id: 'status', 7128 caption: (0,external_wp_i18n_namespaceObject.__)('Status') 7129 }, { 7130 id: 'video', 7131 caption: (0,external_wp_i18n_namespaceObject.__)('Video') 7132 }].sort((a, b) => { 7133 const normalizedA = a.caption.toUpperCase(); 7134 const normalizedB = b.caption.toUpperCase(); 7135 7136 if (normalizedA < normalizedB) { 7137 return -1; 7138 } 7139 7140 if (normalizedA > normalizedB) { 7141 return 1; 7142 } 7143 7144 return 0; 7145 }); 7146 function PostFormat() { 7147 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); 7148 const postFormatSelectorId = `post-format-selector-$instanceId}`; 7149 const { 7150 postFormat, 7151 suggestedFormat, 7152 supportedFormats 7153 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7154 const { 7155 getEditedPostAttribute, 7156 getSuggestedPostFormat 7157 } = select(store_store); 7158 7159 const _postFormat = getEditedPostAttribute('format'); 7160 7161 const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); 7162 return { 7163 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', 7164 suggestedFormat: getSuggestedPostFormat(), 7165 supportedFormats: themeSupports.formats 7166 }; 7167 }, []); 7168 const formats = POST_FORMATS.filter(format => { 7169 // Ensure current format is always in the set. 7170 // The current format may not be a format supported by the theme. 7171 return (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id) || postFormat === format.id; 7172 }); 7173 const suggestion = (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedFormat); 7174 const { 7175 editPost 7176 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 7177 7178 const onUpdatePostFormat = format => editPost({ 7179 format 7180 }); 7181 7182 return (0,external_wp_element_namespaceObject.createElement)(post_format_check, null, (0,external_wp_element_namespaceObject.createElement)("div", { 7183 className: "editor-post-format" 7184 }, (0,external_wp_element_namespaceObject.createElement)("div", { 7185 className: "editor-post-format__content" 7186 }, (0,external_wp_element_namespaceObject.createElement)("label", { 7187 htmlFor: postFormatSelectorId 7188 }, (0,external_wp_i18n_namespaceObject.__)('Post Format')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { 7189 value: postFormat, 7190 onChange: format => onUpdatePostFormat(format), 7191 id: postFormatSelectorId, 7192 options: formats.map(format => ({ 7193 label: format.caption, 7194 value: format.id 7195 })) 7196 })), suggestion && suggestion.id !== postFormat && (0,external_wp_element_namespaceObject.createElement)("div", { 7197 className: "editor-post-format__suggestion" 7198 }, (0,external_wp_i18n_namespaceObject.__)('Suggestion:'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 7199 variant: "link", 7200 onClick: () => onUpdatePostFormat(suggestion.id) 7201 }, (0,external_wp_i18n_namespaceObject.sprintf)( 7202 /* translators: %s: post format */ 7203 (0,external_wp_i18n_namespaceObject.__)('Apply format: %s'), suggestion.caption))))); 7204 } 7205 7206 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js 7207 7208 7209 /** 7210 * WordPress dependencies 7211 */ 7212 7213 const backup = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 7214 xmlns: "http://www.w3.org/2000/svg", 7215 viewBox: "0 0 24 24" 7216 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 7217 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" 7218 })); 7219 /* harmony default export */ var library_backup = (backup); 7220 7221 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js 7222 7223 7224 /** 7225 * WordPress dependencies 7226 */ 7227 7228 /** 7229 * Internal dependencies 7230 */ 7231 7232 7233 7234 function PostLastRevisionCheck(_ref) { 7235 let { 7236 lastRevisionId, 7237 revisionsCount, 7238 children 7239 } = _ref; 7240 7241 if (!lastRevisionId || revisionsCount < 2) { 7242 return null; 7243 } 7244 7245 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { 7246 supportKeys: "revisions" 7247 }, children); 7248 } 7249 /* harmony default export */ var post_last_revision_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { 7250 const { 7251 getCurrentPostLastRevisionId, 7252 getCurrentPostRevisionsCount 7253 } = select(store_store); 7254 return { 7255 lastRevisionId: getCurrentPostLastRevisionId(), 7256 revisionsCount: getCurrentPostRevisionsCount() 7257 }; 7258 })(PostLastRevisionCheck)); 7259 7260 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js 7261 7262 7263 /** 7264 * WordPress dependencies 7265 */ 7266 7267 7268 7269 7270 7271 /** 7272 * Internal dependencies 7273 */ 7274 7275 7276 7277 7278 function LastRevision(_ref) { 7279 let { 7280 lastRevisionId, 7281 revisionsCount 7282 } = _ref; 7283 return (0,external_wp_element_namespaceObject.createElement)(post_last_revision_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 7284 href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 7285 revision: lastRevisionId, 7286 gutenberg: true 7287 }), 7288 className: "editor-post-last-revision__title", 7289 icon: library_backup 7290 }, (0,external_wp_i18n_namespaceObject.sprintf)( 7291 /* translators: %d: number of revisions */ 7292 (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); 7293 } 7294 7295 /* harmony default export */ var post_last_revision = ((0,external_wp_data_namespaceObject.withSelect)(select => { 7296 const { 7297 getCurrentPostLastRevisionId, 7298 getCurrentPostRevisionsCount 7299 } = select(store_store); 7300 return { 7301 lastRevisionId: getCurrentPostLastRevisionId(), 7302 revisionsCount: getCurrentPostRevisionsCount() 7303 }; 7304 })(LastRevision)); 7305 7306 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js 7307 7308 7309 /** 7310 * External dependencies 7311 */ 7312 7313 /** 7314 * WordPress dependencies 7315 */ 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 /** 7326 * Internal dependencies 7327 */ 7328 7329 7330 function PostLockedModal() { 7331 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); 7332 const hookName = 'core/editor/post-locked-modal-' + instanceId; 7333 const { 7334 autosave, 7335 updatePostLock 7336 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 7337 const { 7338 isLocked, 7339 isTakeover, 7340 user, 7341 postId, 7342 postLockUtils, 7343 activePostLock, 7344 postType, 7345 previewLink 7346 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7347 const { 7348 isPostLocked, 7349 isPostLockTakeover, 7350 getPostLockUser, 7351 getCurrentPostId, 7352 getActivePostLock, 7353 getEditedPostAttribute, 7354 getEditedPostPreviewLink, 7355 getEditorSettings 7356 } = select(store_store); 7357 const { 7358 getPostType 7359 } = select(external_wp_coreData_namespaceObject.store); 7360 return { 7361 isLocked: isPostLocked(), 7362 isTakeover: isPostLockTakeover(), 7363 user: getPostLockUser(), 7364 postId: getCurrentPostId(), 7365 postLockUtils: getEditorSettings().postLockUtils, 7366 activePostLock: getActivePostLock(), 7367 postType: getPostType(getEditedPostAttribute('type')), 7368 previewLink: getEditedPostPreviewLink() 7369 }; 7370 }, []); 7371 (0,external_wp_element_namespaceObject.useEffect)(() => { 7372 /** 7373 * Keep the lock refreshed. 7374 * 7375 * When the user does not send a heartbeat in a heartbeat-tick 7376 * the user is no longer editing and another user can start editing. 7377 * 7378 * @param {Object} data Data to send in the heartbeat request. 7379 */ 7380 function sendPostLock(data) { 7381 if (isLocked) { 7382 return; 7383 } 7384 7385 data['wp-refresh-post-lock'] = { 7386 lock: activePostLock, 7387 post_id: postId 7388 }; 7389 } 7390 /** 7391 * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. 7392 * 7393 * @param {Object} data Data received in the heartbeat request 7394 */ 7395 7396 7397 function receivePostLock(data) { 7398 if (!data['wp-refresh-post-lock']) { 7399 return; 7400 } 7401 7402 const received = data['wp-refresh-post-lock']; 7403 7404 if (received.lock_error) { 7405 // Auto save and display the takeover modal. 7406 autosave(); 7407 updatePostLock({ 7408 isLocked: true, 7409 isTakeover: true, 7410 user: { 7411 name: received.lock_error.name, 7412 avatar: received.lock_error.avatar_src_2x 7413 } 7414 }); 7415 } else if (received.new_lock) { 7416 updatePostLock({ 7417 isLocked: false, 7418 activePostLock: received.new_lock 7419 }); 7420 } 7421 } 7422 /** 7423 * Unlock the post before the window is exited. 7424 */ 7425 7426 7427 function releasePostLock() { 7428 if (isLocked || !activePostLock) { 7429 return; 7430 } 7431 7432 const data = new window.FormData(); 7433 data.append('action', 'wp-remove-post-lock'); 7434 data.append('_wpnonce', postLockUtils.unlockNonce); 7435 data.append('post_ID', postId); 7436 data.append('active_post_lock', activePostLock); 7437 7438 if (window.navigator.sendBeacon) { 7439 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); 7440 } else { 7441 const xhr = new window.XMLHttpRequest(); 7442 xhr.open('POST', postLockUtils.ajaxUrl, false); 7443 xhr.send(data); 7444 } 7445 } // Details on these events on the Heartbeat API docs 7446 // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ 7447 7448 7449 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock); 7450 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock); 7451 window.addEventListener('beforeunload', releasePostLock); 7452 return () => { 7453 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName); 7454 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName); 7455 window.removeEventListener('beforeunload', releasePostLock); 7456 }; 7457 }, []); 7458 7459 if (!isLocked) { 7460 return null; 7461 } 7462 7463 const userDisplayName = user.name; 7464 const userAvatar = user.avatar; 7465 const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 7466 'get-post-lock': '1', 7467 lockKey: true, 7468 post: postId, 7469 action: 'edit', 7470 _wpnonce: postLockUtils.nonce 7471 }); 7472 const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 7473 post_type: (0,external_lodash_namespaceObject.get)(postType, ['slug']) 7474 }); 7475 7476 const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor'); 7477 7478 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 7479 title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'), 7480 focusOnMount: true, 7481 shouldCloseOnClickOutside: false, 7482 shouldCloseOnEsc: false, 7483 isDismissible: false, 7484 className: "editor-post-locked-modal" 7485 }, !!userAvatar && (0,external_wp_element_namespaceObject.createElement)("img", { 7486 src: userAvatar, 7487 alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'), 7488 className: "editor-post-locked-modal__avatar", 7489 width: 64, 7490 height: 64 7491 }), (0,external_wp_element_namespaceObject.createElement)("div", null, !!isTakeover && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( 7492 /* translators: %s: user's display name */ 7493 (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this posts (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), { 7494 strong: (0,external_wp_element_namespaceObject.createElement)("strong", null), 7495 PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 7496 href: previewLink 7497 }, (0,external_wp_i18n_namespaceObject.__)('preview')) 7498 })), !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( 7499 /* translators: %s: user's display name */ 7500 (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), { 7501 strong: (0,external_wp_element_namespaceObject.createElement)("strong", null), 7502 PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 7503 href: previewLink 7504 }, (0,external_wp_i18n_namespaceObject.__)('preview')) 7505 })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 7506 className: "editor-post-locked-modal__buttons", 7507 justify: "flex-end", 7508 expanded: false 7509 }, !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 7510 variant: "tertiary", 7511 href: unlockUrl 7512 }, (0,external_wp_i18n_namespaceObject.__)('Take over'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 7513 variant: "primary", 7514 href: allPostsUrl 7515 }, allPostsLabel))))); 7516 } 7517 7518 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js 7519 /** 7520 * External dependencies 7521 */ 7522 7523 /** 7524 * WordPress dependencies 7525 */ 7526 7527 7528 7529 /** 7530 * Internal dependencies 7531 */ 7532 7533 7534 function PostPendingStatusCheck(_ref) { 7535 let { 7536 hasPublishAction, 7537 isPublished, 7538 children 7539 } = _ref; 7540 7541 if (isPublished || !hasPublishAction) { 7542 return null; 7543 } 7544 7545 return children; 7546 } 7547 /* harmony default export */ var post_pending_status_check = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { 7548 const { 7549 isCurrentPostPublished, 7550 getCurrentPostType, 7551 getCurrentPost 7552 } = select(store_store); 7553 return { 7554 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 7555 isPublished: isCurrentPostPublished(), 7556 postType: getCurrentPostType() 7557 }; 7558 }))(PostPendingStatusCheck)); 7559 7560 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js 7561 7562 7563 /** 7564 * WordPress dependencies 7565 */ 7566 7567 7568 7569 7570 /** 7571 * Internal dependencies 7572 */ 7573 7574 7575 7576 function PostPendingStatus(_ref) { 7577 let { 7578 status, 7579 onUpdateStatus 7580 } = _ref; 7581 7582 const togglePendingStatus = () => { 7583 const updatedStatus = status === 'pending' ? 'draft' : 'pending'; 7584 onUpdateStatus(updatedStatus); 7585 }; 7586 7587 return (0,external_wp_element_namespaceObject.createElement)(post_pending_status_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 7588 label: (0,external_wp_i18n_namespaceObject.__)('Pending review'), 7589 checked: status === 'pending', 7590 onChange: togglePendingStatus 7591 })); 7592 } 7593 /* harmony default export */ var post_pending_status = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ 7594 status: select(store_store).getEditedPostAttribute('status') 7595 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 7596 onUpdateStatus(status) { 7597 dispatch(store_store).editPost({ 7598 status 7599 }); 7600 } 7601 7602 })))(PostPendingStatus)); 7603 7604 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js 7605 7606 7607 /** 7608 * WordPress dependencies 7609 */ 7610 7611 7612 7613 7614 /** 7615 * Internal dependencies 7616 */ 7617 7618 7619 7620 function PostPingbacks(_ref) { 7621 let { 7622 pingStatus = 'open', 7623 ...props 7624 } = _ref; 7625 7626 const onTogglePingback = () => props.editPost({ 7627 ping_status: pingStatus === 'open' ? 'closed' : 'open' 7628 }); 7629 7630 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 7631 label: (0,external_wp_i18n_namespaceObject.__)('Allow pingbacks & trackbacks'), 7632 checked: pingStatus === 'open', 7633 onChange: onTogglePingback 7634 }); 7635 } 7636 7637 /* harmony default export */ var post_pingbacks = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 7638 return { 7639 pingStatus: select(store_store).getEditedPostAttribute('ping_status') 7640 }; 7641 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 7642 editPost: dispatch(store_store).editPost 7643 }))])(PostPingbacks)); 7644 7645 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js 7646 7647 7648 /** 7649 * External dependencies 7650 */ 7651 7652 7653 /** 7654 * WordPress dependencies 7655 */ 7656 7657 7658 7659 7660 7661 7662 7663 7664 /** 7665 * Internal dependencies 7666 */ 7667 7668 7669 7670 function writeInterstitialMessage(targetDocument) { 7671 let markup = (0,external_wp_element_namespaceObject.renderToString)((0,external_wp_element_namespaceObject.createElement)("div", { 7672 className: "editor-post-preview-button__interstitial-message" 7673 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { 7674 xmlns: "http://www.w3.org/2000/svg", 7675 viewBox: "0 0 96 96" 7676 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { 7677 className: "outer", 7678 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", 7679 fill: "none" 7680 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { 7681 className: "inner", 7682 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", 7683 fill: "none" 7684 })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Generating preview…')))); 7685 markup += ` 7686 <style> 7687 body { 7688 margin: 0; 7689 } 7690 .editor-post-preview-button__interstitial-message { 7691 display: flex; 7692 flex-direction: column; 7693 align-items: center; 7694 justify-content: center; 7695 height: 100vh; 7696 width: 100vw; 7697 } 7698 @-webkit-keyframes paint { 7699 0% { 7700 stroke-dashoffset: 0; 7701 } 7702 } 7703 @-moz-keyframes paint { 7704 0% { 7705 stroke-dashoffset: 0; 7706 } 7707 } 7708 @-o-keyframes paint { 7709 0% { 7710 stroke-dashoffset: 0; 7711 } 7712 } 7713 @keyframes paint { 7714 0% { 7715 stroke-dashoffset: 0; 7716 } 7717 } 7718 .editor-post-preview-button__interstitial-message svg { 7719 width: 192px; 7720 height: 192px; 7721 stroke: #555d66; 7722 stroke-width: 0.75; 7723 } 7724 .editor-post-preview-button__interstitial-message svg .outer, 7725 .editor-post-preview-button__interstitial-message svg .inner { 7726 stroke-dasharray: 280; 7727 stroke-dashoffset: 280; 7728 -webkit-animation: paint 1.5s ease infinite alternate; 7729 -moz-animation: paint 1.5s ease infinite alternate; 7730 -o-animation: paint 1.5s ease infinite alternate; 7731 animation: paint 1.5s ease infinite alternate; 7732 } 7733 p { 7734 text-align: center; 7735 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 7736 } 7737 </style> 7738 `; 7739 /** 7740 * Filters the interstitial message shown when generating previews. 7741 * 7742 * @param {string} markup The preview interstitial markup. 7743 */ 7744 7745 markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup); 7746 targetDocument.write(markup); 7747 targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…'); 7748 targetDocument.close(); 7749 } 7750 7751 class PostPreviewButton extends external_wp_element_namespaceObject.Component { 7752 constructor() { 7753 super(...arguments); 7754 this.buttonRef = (0,external_wp_element_namespaceObject.createRef)(); 7755 this.openPreviewWindow = this.openPreviewWindow.bind(this); 7756 } 7757 7758 componentDidUpdate(prevProps) { 7759 const { 7760 previewLink 7761 } = this.props; // This relies on the window being responsible to unset itself when 7762 // navigation occurs or a new preview window is opened, to avoid 7763 // unintentional forceful redirects. 7764 7765 if (previewLink && !prevProps.previewLink) { 7766 this.setPreviewWindowLink(previewLink); 7767 } 7768 } 7769 /** 7770 * Sets the preview window's location to the given URL, if a preview window 7771 * exists and is not closed. 7772 * 7773 * @param {string} url URL to assign as preview window location. 7774 */ 7775 7776 7777 setPreviewWindowLink(url) { 7778 const { 7779 previewWindow 7780 } = this; 7781 7782 if (previewWindow && !previewWindow.closed) { 7783 previewWindow.location = url; 7784 7785 if (this.buttonRef.current) { 7786 this.buttonRef.current.focus(); 7787 } 7788 } 7789 } 7790 7791 getWindowTarget() { 7792 const { 7793 postId 7794 } = this.props; 7795 return `wp-preview-$postId}`; 7796 } 7797 7798 openPreviewWindow(event) { 7799 // Our Preview button has its 'href' and 'target' set correctly for a11y 7800 // purposes. Unfortunately, though, we can't rely on the default 'click' 7801 // handler since sometimes it incorrectly opens a new tab instead of reusing 7802 // the existing one. 7803 // https://github.com/WordPress/gutenberg/pull/8330 7804 event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview. 7805 7806 if (!this.previewWindow || this.previewWindow.closed) { 7807 this.previewWindow = window.open('', this.getWindowTarget()); 7808 } // Focus the Preview tab. This might not do anything, depending on the browser's 7809 // and user's preferences. 7810 // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus 7811 7812 7813 this.previewWindow.focus(); 7814 7815 if ( // If we don't need to autosave the post before previewing, then we simply 7816 // load the Preview URL in the Preview tab. 7817 !this.props.isAutosaveable || // Do not save or overwrite the post, if the post is already locked. 7818 this.props.isPostLocked) { 7819 this.setPreviewWindowLink(event.target.href); 7820 return; 7821 } // Request an autosave. This happens asynchronously and causes the component 7822 // to update when finished. 7823 7824 7825 if (this.props.isDraft) { 7826 this.props.savePost({ 7827 isPreview: true 7828 }); 7829 } else { 7830 this.props.autosave({ 7831 isPreview: true 7832 }); 7833 } // Display a 'Generating preview' message in the Preview tab while we wait for the 7834 // autosave to finish. 7835 7836 7837 writeInterstitialMessage(this.previewWindow.document); 7838 } 7839 7840 render() { 7841 const { 7842 previewLink, 7843 currentPostLink, 7844 isSaveable, 7845 role 7846 } = this.props; // Link to the `?preview=true` URL if we have it, since this lets us see 7847 // changes that were autosaved since the post was last published. Otherwise, 7848 // just link to the post's URL. 7849 7850 const href = previewLink || currentPostLink; 7851 const classNames = classnames_default()({ 7852 'editor-post-preview': !this.props.className 7853 }, this.props.className); 7854 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 7855 variant: !this.props.className ? 'tertiary' : undefined, 7856 className: classNames, 7857 href: href, 7858 target: this.getWindowTarget(), 7859 disabled: !isSaveable, 7860 onClick: this.openPreviewWindow, 7861 ref: this.buttonRef, 7862 role: role 7863 }, this.props.textContent ? this.props.textContent : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 7864 as: "span" 7865 }, 7866 /* translators: accessibility text */ 7867 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))); 7868 } 7869 7870 } 7871 /* harmony default export */ var post_preview_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref) => { 7872 let { 7873 forcePreviewLink, 7874 forceIsAutosaveable 7875 } = _ref; 7876 const { 7877 getCurrentPostId, 7878 getCurrentPostAttribute, 7879 getEditedPostAttribute, 7880 isEditedPostSaveable, 7881 isEditedPostAutosaveable, 7882 getEditedPostPreviewLink, 7883 isPostLocked 7884 } = select(store_store); 7885 const { 7886 getPostType 7887 } = select(external_wp_coreData_namespaceObject.store); 7888 const previewLink = getEditedPostPreviewLink(); 7889 const postType = getPostType(getEditedPostAttribute('type')); 7890 return { 7891 postId: getCurrentPostId(), 7892 currentPostLink: getCurrentPostAttribute('link'), 7893 previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, 7894 isSaveable: isEditedPostSaveable(), 7895 isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), 7896 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false), 7897 isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1, 7898 isPostLocked: isPostLocked() 7899 }; 7900 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ 7901 autosave: dispatch(store_store).autosave, 7902 savePost: dispatch(store_store).savePost 7903 })), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => { 7904 let { 7905 isViewable 7906 } = _ref2; 7907 return isViewable; 7908 })])(PostPreviewButton)); 7909 7910 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js 7911 /** 7912 * External dependencies 7913 */ 7914 7915 /** 7916 * WordPress dependencies 7917 */ 7918 7919 7920 7921 7922 /** 7923 * Internal dependencies 7924 */ 7925 7926 7927 function PublishButtonLabel(_ref) { 7928 let { 7929 isPublished, 7930 isBeingScheduled, 7931 isSaving, 7932 isPublishing, 7933 hasPublishAction, 7934 isAutosaving, 7935 hasNonPostEntityChanges 7936 } = _ref; 7937 7938 if (isPublishing) { 7939 /* translators: button label text should, if possible, be under 16 characters. */ 7940 return (0,external_wp_i18n_namespaceObject.__)('Publishing…'); 7941 } else if (isPublished && isSaving && !isAutosaving) { 7942 /* translators: button label text should, if possible, be under 16 characters. */ 7943 return (0,external_wp_i18n_namespaceObject.__)('Updating…'); 7944 } else if (isBeingScheduled && isSaving && !isAutosaving) { 7945 /* translators: button label text should, if possible, be under 16 characters. */ 7946 return (0,external_wp_i18n_namespaceObject.__)('Scheduling…'); 7947 } 7948 7949 if (!hasPublishAction) { 7950 return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Submit for Review…') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review'); 7951 } else if (isPublished) { 7952 return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Update…') : (0,external_wp_i18n_namespaceObject.__)('Update'); 7953 } else if (isBeingScheduled) { 7954 return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Schedule'); 7955 } 7956 7957 return (0,external_wp_i18n_namespaceObject.__)('Publish'); 7958 } 7959 /* harmony default export */ var label = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { 7960 let { 7961 forceIsSaving 7962 } = _ref2; 7963 const { 7964 isCurrentPostPublished, 7965 isEditedPostBeingScheduled, 7966 isSavingPost, 7967 isPublishingPost, 7968 getCurrentPost, 7969 getCurrentPostType, 7970 isAutosavingPost 7971 } = select(store_store); 7972 return { 7973 isPublished: isCurrentPostPublished(), 7974 isBeingScheduled: isEditedPostBeingScheduled(), 7975 isSaving: forceIsSaving || isSavingPost(), 7976 isPublishing: isPublishingPost(), 7977 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 7978 postType: getCurrentPostType(), 7979 isAutosaving: isAutosavingPost() 7980 }; 7981 })])(PublishButtonLabel)); 7982 7983 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js 7984 7985 7986 7987 /** 7988 * External dependencies 7989 */ 7990 7991 7992 /** 7993 * WordPress dependencies 7994 */ 7995 7996 7997 7998 7999 8000 8001 /** 8002 * Internal dependencies 8003 */ 8004 8005 8006 8007 class PostPublishButton extends external_wp_element_namespaceObject.Component { 8008 constructor(props) { 8009 super(props); 8010 this.buttonNode = (0,external_wp_element_namespaceObject.createRef)(); 8011 this.createOnClick = this.createOnClick.bind(this); 8012 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); 8013 this.state = { 8014 entitiesSavedStatesCallback: false 8015 }; 8016 } 8017 8018 componentDidMount() { 8019 if (this.props.focusOnMount) { 8020 this.buttonNode.current.focus(); 8021 } 8022 } 8023 8024 createOnClick(callback) { 8025 var _this = this; 8026 8027 return function () { 8028 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 8029 args[_key] = arguments[_key]; 8030 } 8031 8032 const { 8033 hasNonPostEntityChanges, 8034 setEntitiesSavedStatesCallback 8035 } = _this.props; // If a post with non-post entities is published, but the user 8036 // elects to not save changes to the non-post entities, those 8037 // entities will still be dirty when the Publish button is clicked. 8038 // We also need to check that the `setEntitiesSavedStatesCallback` 8039 // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383 8040 8041 if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { 8042 // The modal for multiple entity saving will open, 8043 // hold the callback for saving/publishing the post 8044 // so that we can call it if the post entity is checked. 8045 _this.setState({ 8046 entitiesSavedStatesCallback: () => callback(...args) 8047 }); // Open the save panel by setting its callback. 8048 // To set a function on the useState hook, we must set it 8049 // with another function (() => myFunction). Passing the 8050 // function on its own will cause an error when called. 8051 8052 8053 setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates); 8054 return external_lodash_namespaceObject.noop; 8055 } 8056 8057 return callback(...args); 8058 }; 8059 } 8060 8061 closeEntitiesSavedStates(savedEntities) { 8062 const { 8063 postType, 8064 postId 8065 } = this.props; 8066 const { 8067 entitiesSavedStatesCallback 8068 } = this.state; 8069 this.setState({ 8070 entitiesSavedStatesCallback: false 8071 }, () => { 8072 if (savedEntities && (0,external_lodash_namespaceObject.some)(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { 8073 // The post entity was checked, call the held callback from `createOnClick`. 8074 entitiesSavedStatesCallback(); 8075 } 8076 }); 8077 } 8078 8079 render() { 8080 const { 8081 forceIsDirty, 8082 forceIsSaving, 8083 hasPublishAction, 8084 isBeingScheduled, 8085 isOpen, 8086 isPostSavingLocked, 8087 isPublishable, 8088 isPublished, 8089 isSaveable, 8090 isSaving, 8091 isAutoSaving, 8092 isToggle, 8093 onSave, 8094 onStatusChange, 8095 onSubmit = external_lodash_namespaceObject.noop, 8096 onToggle, 8097 visibility, 8098 hasNonPostEntityChanges, 8099 isSavingNonPostEntityChanges 8100 } = this.props; 8101 const isButtonDisabled = (isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 8102 const isToggleDisabled = (isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 8103 let publishStatus; 8104 8105 if (!hasPublishAction) { 8106 publishStatus = 'pending'; 8107 } else if (visibility === 'private') { 8108 publishStatus = 'private'; 8109 } else if (isBeingScheduled) { 8110 publishStatus = 'future'; 8111 } else { 8112 publishStatus = 'publish'; 8113 } 8114 8115 const onClickButton = () => { 8116 if (isButtonDisabled) { 8117 return; 8118 } 8119 8120 onSubmit(); 8121 onStatusChange(publishStatus); 8122 onSave(); 8123 }; 8124 8125 const onClickToggle = () => { 8126 if (isToggleDisabled) { 8127 return; 8128 } 8129 8130 onToggle(); 8131 }; 8132 8133 const buttonProps = { 8134 'aria-disabled': isButtonDisabled, 8135 className: 'editor-post-publish-button', 8136 isBusy: !isAutoSaving && isSaving && isPublished, 8137 variant: 'primary', 8138 onClick: this.createOnClick(onClickButton) 8139 }; 8140 const toggleProps = { 8141 'aria-disabled': isToggleDisabled, 8142 'aria-expanded': isOpen, 8143 className: 'editor-post-publish-panel__toggle', 8144 isBusy: isSaving && isPublished, 8145 variant: 'primary', 8146 onClick: this.createOnClick(onClickToggle) 8147 }; 8148 const toggleChildren = isBeingScheduled ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Publish'); 8149 const buttonChildren = (0,external_wp_element_namespaceObject.createElement)(label, { 8150 forceIsSaving: forceIsSaving, 8151 hasNonPostEntityChanges: hasNonPostEntityChanges 8152 }); 8153 const componentProps = isToggle ? toggleProps : buttonProps; 8154 const componentChildren = isToggle ? toggleChildren : buttonChildren; 8155 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({ 8156 ref: this.buttonNode 8157 }, componentProps, { 8158 className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', { 8159 'has-changes-dot': hasNonPostEntityChanges 8160 }) 8161 }), componentChildren)); 8162 } 8163 8164 } 8165 /* harmony default export */ var post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 8166 const { 8167 isSavingPost, 8168 isAutosavingPost, 8169 isEditedPostBeingScheduled, 8170 getEditedPostVisibility, 8171 isCurrentPostPublished, 8172 isEditedPostSaveable, 8173 isEditedPostPublishable, 8174 isPostSavingLocked, 8175 getCurrentPost, 8176 getCurrentPostType, 8177 getCurrentPostId, 8178 hasNonPostEntityChanges, 8179 isSavingNonPostEntityChanges 8180 } = select(store_store); 8181 8182 const _isAutoSaving = isAutosavingPost(); 8183 8184 return { 8185 isSaving: isSavingPost() || _isAutoSaving, 8186 isAutoSaving: _isAutoSaving, 8187 isBeingScheduled: isEditedPostBeingScheduled(), 8188 visibility: getEditedPostVisibility(), 8189 isSaveable: isEditedPostSaveable(), 8190 isPostSavingLocked: isPostSavingLocked(), 8191 isPublishable: isEditedPostPublishable(), 8192 isPublished: isCurrentPostPublished(), 8193 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 8194 postType: getCurrentPostType(), 8195 postId: getCurrentPostId(), 8196 hasNonPostEntityChanges: hasNonPostEntityChanges(), 8197 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() 8198 }; 8199 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 8200 const { 8201 editPost, 8202 savePost 8203 } = dispatch(store_store); 8204 return { 8205 onStatusChange: status => editPost({ 8206 status 8207 }, { 8208 undoIgnore: true 8209 }), 8210 onSave: savePost 8211 }; 8212 })])(PostPublishButton)); 8213 8214 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 8215 8216 8217 /** 8218 * WordPress dependencies 8219 */ 8220 8221 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 8222 xmlns: "http://www.w3.org/2000/svg", 8223 viewBox: "0 0 24 24" 8224 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 8225 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" 8226 })); 8227 /* harmony default export */ var close_small = (closeSmall); 8228 8229 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js 8230 8231 8232 /** 8233 * WordPress dependencies 8234 */ 8235 8236 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 8237 xmlns: "http://www.w3.org/2000/svg", 8238 viewBox: "-2 -2 24 24" 8239 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 8240 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" 8241 })); 8242 /* harmony default export */ var library_wordpress = (wordpress); 8243 8244 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js 8245 function _defineProperty(obj, key, value) { 8246 if (key in obj) { 8247 Object.defineProperty(obj, key, { 8248 value: value, 8249 enumerable: true, 8250 configurable: true, 8251 writable: true 8252 }); 8253 } else { 8254 obj[key] = value; 8255 } 8256 8257 return obj; 8258 } 8259 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js 8260 /** 8261 * WordPress dependencies 8262 */ 8263 8264 const visibilityOptions = [{ 8265 value: 'public', 8266 label: (0,external_wp_i18n_namespaceObject.__)('Public'), 8267 info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 8268 }, { 8269 value: 'private', 8270 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 8271 info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 8272 }, { 8273 value: 'password', 8274 label: (0,external_wp_i18n_namespaceObject.__)('Password Protected'), 8275 info: (0,external_wp_i18n_namespaceObject.__)('Protected with a password you choose. Only those with the password can view this post.') 8276 }]; 8277 8278 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js 8279 8280 8281 8282 /** 8283 * WordPress dependencies 8284 */ 8285 8286 8287 8288 8289 8290 /** 8291 * Internal dependencies 8292 */ 8293 8294 8295 8296 class PostVisibility extends external_wp_element_namespaceObject.Component { 8297 constructor(props) { 8298 super(...arguments); 8299 8300 _defineProperty(this, "confirmPrivate", () => { 8301 const { 8302 onUpdateVisibility, 8303 onSave 8304 } = this.props; 8305 onUpdateVisibility('private'); 8306 this.setState({ 8307 hasPassword: false, 8308 showPrivateConfirmDialog: false 8309 }); 8310 onSave(); 8311 }); 8312 8313 _defineProperty(this, "handleDialogCancel", () => { 8314 this.setState({ 8315 showPrivateConfirmDialog: false 8316 }); 8317 }); 8318 8319 this.setPublic = this.setPublic.bind(this); 8320 this.setPrivate = this.setPrivate.bind(this); 8321 this.setPasswordProtected = this.setPasswordProtected.bind(this); 8322 this.updatePassword = this.updatePassword.bind(this); 8323 this.state = { 8324 hasPassword: !!props.password, 8325 showPrivateConfirmDialog: false 8326 }; 8327 } 8328 8329 setPublic() { 8330 const { 8331 visibility, 8332 onUpdateVisibility, 8333 status 8334 } = this.props; 8335 onUpdateVisibility(visibility === 'private' ? 'draft' : status); 8336 this.setState({ 8337 hasPassword: false 8338 }); 8339 } 8340 8341 setPrivate() { 8342 this.setState({ 8343 showPrivateConfirmDialog: true 8344 }); 8345 } 8346 8347 setPasswordProtected() { 8348 const { 8349 visibility, 8350 onUpdateVisibility, 8351 status, 8352 password 8353 } = this.props; 8354 onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || ''); 8355 this.setState({ 8356 hasPassword: true 8357 }); 8358 } 8359 8360 updatePassword(event) { 8361 const { 8362 status, 8363 onUpdateVisibility 8364 } = this.props; 8365 onUpdateVisibility(status, event.target.value); 8366 } 8367 8368 render() { 8369 const { 8370 visibility, 8371 password, 8372 instanceId 8373 } = this.props; 8374 const visibilityHandlers = { 8375 public: { 8376 onSelect: this.setPublic, 8377 checked: visibility === 'public' && !this.state.hasPassword 8378 }, 8379 private: { 8380 onSelect: this.setPrivate, 8381 checked: visibility === 'private' 8382 }, 8383 password: { 8384 onSelect: this.setPasswordProtected, 8385 checked: this.state.hasPassword 8386 } 8387 }; 8388 return [(0,external_wp_element_namespaceObject.createElement)("fieldset", { 8389 key: "visibility-selector", 8390 className: "editor-post-visibility__dialog-fieldset" 8391 }, (0,external_wp_element_namespaceObject.createElement)("legend", { 8392 className: "editor-post-visibility__dialog-legend" 8393 }, (0,external_wp_i18n_namespaceObject.__)('Post Visibility')), visibilityOptions.map(_ref => { 8394 let { 8395 value, 8396 label, 8397 info 8398 } = _ref; 8399 return (0,external_wp_element_namespaceObject.createElement)("div", { 8400 key: value, 8401 className: "editor-post-visibility__choice" 8402 }, (0,external_wp_element_namespaceObject.createElement)("input", { 8403 type: "radio", 8404 name: `editor-post-visibility__setting-$instanceId}`, 8405 value: value, 8406 onChange: visibilityHandlers[value].onSelect, 8407 checked: visibilityHandlers[value].checked, 8408 id: `editor-post-$value}-$instanceId}`, 8409 "aria-describedby": `editor-post-$value}-$instanceId}-description`, 8410 className: "editor-post-visibility__dialog-radio" 8411 }), (0,external_wp_element_namespaceObject.createElement)("label", { 8412 htmlFor: `editor-post-$value}-$instanceId}`, 8413 className: "editor-post-visibility__dialog-label" 8414 }, label), (0,external_wp_element_namespaceObject.createElement)("p", { 8415 id: `editor-post-$value}-$instanceId}-description`, 8416 className: "editor-post-visibility__dialog-info" 8417 }, info)); 8418 })), this.state.hasPassword && (0,external_wp_element_namespaceObject.createElement)("div", { 8419 className: "editor-post-visibility__dialog-password", 8420 key: "password-selector" 8421 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 8422 as: "label", 8423 htmlFor: `editor-post-visibility__dialog-password-input-$instanceId}` 8424 }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_wp_element_namespaceObject.createElement)("input", { 8425 className: "editor-post-visibility__dialog-password-input", 8426 id: `editor-post-visibility__dialog-password-input-$instanceId}`, 8427 type: "text", 8428 onChange: this.updatePassword, 8429 value: password, 8430 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password') 8431 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 8432 key: "private-publish-confirmation", 8433 isOpen: this.state.showPrivateConfirmDialog, 8434 onConfirm: this.confirmPrivate, 8435 onCancel: this.handleDialogCancel 8436 }, (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?'))]; 8437 } 8438 8439 } 8440 /* harmony default export */ var post_visibility = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 8441 const { 8442 getEditedPostAttribute, 8443 getEditedPostVisibility 8444 } = select(store_store); 8445 return { 8446 status: getEditedPostAttribute('status'), 8447 visibility: getEditedPostVisibility(), 8448 password: getEditedPostAttribute('password') 8449 }; 8450 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 8451 const { 8452 savePost, 8453 editPost 8454 } = dispatch(store_store); 8455 return { 8456 onSave: savePost, 8457 8458 onUpdateVisibility(status) { 8459 let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 8460 editPost({ 8461 status, 8462 password 8463 }); 8464 } 8465 8466 }; 8467 }), external_wp_compose_namespaceObject.withInstanceId])(PostVisibility)); 8468 8469 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js 8470 /** 8471 * External dependencies 8472 */ 8473 8474 /** 8475 * WordPress dependencies 8476 */ 8477 8478 8479 /** 8480 * Internal dependencies 8481 */ 8482 8483 8484 8485 8486 function PostVisibilityLabel(_ref) { 8487 let { 8488 visibility 8489 } = _ref; 8490 8491 const getVisibilityLabel = () => (0,external_lodash_namespaceObject.find)(visibilityOptions, { 8492 value: visibility 8493 }).label; 8494 8495 return getVisibilityLabel(visibility); 8496 } 8497 8498 /* harmony default export */ var post_visibility_label = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ 8499 visibility: select(store_store).getEditedPostVisibility() 8500 }))(PostVisibilityLabel)); 8501 8502 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js 8503 8504 8505 /** 8506 * WordPress dependencies 8507 */ 8508 8509 8510 8511 8512 8513 /** 8514 * Internal dependencies 8515 */ 8516 8517 8518 8519 function getDayOfTheMonth() { 8520 let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date(); 8521 let firstDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 8522 const d = new Date(date); 8523 return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString(); 8524 } 8525 8526 function PostSchedule() { 8527 const { 8528 postDate, 8529 postType 8530 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 8531 postDate: select(store_store).getEditedPostAttribute('date'), 8532 postType: select(store_store).getCurrentPostType() 8533 }), []); 8534 const { 8535 editPost 8536 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 8537 8538 const onUpdateDate = date => editPost({ 8539 date 8540 }); 8541 8542 const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts. 8543 8544 const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, { 8545 status: 'publish,future', 8546 after: getDayOfTheMonth(previewedMonth), 8547 before: getDayOfTheMonth(previewedMonth, false), 8548 exclude: [select(store_store).getCurrentPostId()] 8549 }), [previewedMonth, postType]); 8550 const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(_ref => { 8551 let { 8552 title, 8553 type, 8554 date: eventDate 8555 } = _ref; 8556 return { 8557 title: title === null || title === void 0 ? void 0 : title.rendered, 8558 type, 8559 date: new Date(eventDate) 8560 }; 8561 }), [eventsByPostType]); 8562 const ref = (0,external_wp_element_namespaceObject.useRef)(); 8563 8564 const settings = (0,external_wp_date_namespaceObject.__experimentalGetSettings)(); // To know if the current timezone is a 12 hour time with look for "a" in the time format 8565 // We also make sure this a is not escaped by a "/" 8566 8567 8568 const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a. 8569 .replace(/\\\\/g, '') // Replace "//" with empty strings. 8570 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash. 8571 ); 8572 8573 function onChange(newDate) { 8574 onUpdateDate(newDate); 8575 const { 8576 ownerDocument 8577 } = ref.current; 8578 ownerDocument.activeElement.blur(); 8579 } 8580 8581 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DateTimePicker, { 8582 ref: ref, 8583 currentDate: postDate, 8584 onChange: onChange, 8585 is12Hour: is12HourTime, 8586 events: events, 8587 onMonthPreviewed: setPreviewedMonth 8588 }); 8589 } 8590 8591 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js 8592 /** 8593 * WordPress dependencies 8594 */ 8595 8596 8597 8598 /** 8599 * Internal dependencies 8600 */ 8601 8602 8603 function PostScheduleLabel(_ref) { 8604 let { 8605 date, 8606 isFloating 8607 } = _ref; 8608 8609 const settings = (0,external_wp_date_namespaceObject.__experimentalGetSettings)(); 8610 8611 return date && !isFloating ? (0,external_wp_date_namespaceObject.format)(`$settings.formats.date} $settings.formats.time}`, date) : (0,external_wp_i18n_namespaceObject.__)('Immediately'); 8612 } 8613 /* harmony default export */ var post_schedule_label = ((0,external_wp_data_namespaceObject.withSelect)(select => { 8614 return { 8615 date: select(store_store).getEditedPostAttribute('date'), 8616 isFloating: select(store_store).isEditedPostDateFloating() 8617 }; 8618 })(PostScheduleLabel)); 8619 8620 ;// CONCATENATED MODULE: external ["wp","a11y"] 8621 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 8622 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js 8623 8624 8625 /** 8626 * External dependencies 8627 */ 8628 8629 /** 8630 * WordPress dependencies 8631 */ 8632 8633 8634 8635 8636 /** 8637 * Internal dependencies 8638 */ 8639 8640 8641 const MIN_MOST_USED_TERMS = 3; 8642 const DEFAULT_QUERY = { 8643 per_page: 10, 8644 orderby: 'count', 8645 order: 'desc', 8646 hide_empty: true, 8647 _fields: 'id,name,count', 8648 context: 'view' 8649 }; 8650 function MostUsedTerms(_ref) { 8651 let { 8652 onSelect, 8653 taxonomy 8654 } = _ref; 8655 const { 8656 _terms, 8657 showTerms 8658 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8659 const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); 8660 return { 8661 _terms: mostUsedTerms, 8662 showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MIN_MOST_USED_TERMS 8663 }; 8664 }, []); 8665 8666 if (!showTerms) { 8667 return null; 8668 } 8669 8670 const terms = unescapeTerms(_terms); 8671 const label = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'most_used']); 8672 return (0,external_wp_element_namespaceObject.createElement)("div", { 8673 className: "editor-post-taxonomies__flat-term-most-used" 8674 }, (0,external_wp_element_namespaceObject.createElement)("h3", { 8675 className: "editor-post-taxonomies__flat-term-most-used-label" 8676 }, label), (0,external_wp_element_namespaceObject.createElement)("ul", { 8677 role: "list", 8678 className: "editor-post-taxonomies__flat-term-most-used-list" 8679 }, terms.map(term => (0,external_wp_element_namespaceObject.createElement)("li", { 8680 key: term.id 8681 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 8682 variant: "link", 8683 onClick: () => onSelect(term) 8684 }, term.name))))); 8685 } 8686 8687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js 8688 8689 8690 /** 8691 * External dependencies 8692 */ 8693 8694 /** 8695 * WordPress dependencies 8696 */ 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 /** 8708 * Internal dependencies 8709 */ 8710 8711 8712 8713 8714 /** 8715 * Shared reference to an empty array for cases where it is important to avoid 8716 * returning a new array reference on every invocation. 8717 * 8718 * @type {Array<any>} 8719 */ 8720 8721 const flat_term_selector_EMPTY_ARRAY = []; 8722 /** 8723 * Module constants 8724 */ 8725 8726 const MAX_TERMS_SUGGESTIONS = 20; 8727 const flat_term_selector_DEFAULT_QUERY = { 8728 per_page: MAX_TERMS_SUGGESTIONS, 8729 orderby: 'count', 8730 order: 'desc', 8731 _fields: 'id,name', 8732 context: 'view' 8733 }; 8734 8735 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); 8736 8737 const termNamesToIds = (names, terms) => { 8738 return names.map(termName => (0,external_lodash_namespaceObject.find)(terms, term => isSameTermName(term.name, termName)).id); 8739 }; // Tries to create a term or fetch it if it already exists. 8740 8741 8742 function findOrCreateTerm(termName, restBase) { 8743 const escapedTermName = (0,external_lodash_namespaceObject.escape)(termName); 8744 return external_wp_apiFetch_default()({ 8745 path: `/wp/v2/$restBase}`, 8746 method: 'POST', 8747 data: { 8748 name: escapedTermName 8749 } 8750 }).catch(error => { 8751 const errorCode = error.code; 8752 8753 if (errorCode === 'term_exists') { 8754 // If the terms exist, fetch it instead of creating a new one. 8755 const addRequest = external_wp_apiFetch_default()({ 8756 path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/$restBase}`, { ...flat_term_selector_DEFAULT_QUERY, 8757 search: escapedTermName 8758 }) 8759 }).then(unescapeTerms); 8760 return addRequest.then(searchResult => { 8761 return (0,external_lodash_namespaceObject.find)(searchResult, result => isSameTermName(result.name, termName)); 8762 }); 8763 } 8764 8765 return Promise.reject(error); 8766 }).then(unescapeTerm); 8767 } 8768 8769 function FlatTermSelector(_ref) { 8770 let { 8771 slug 8772 } = _ref; 8773 const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); 8774 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); 8775 const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); 8776 const { 8777 terms, 8778 termIds, 8779 taxonomy, 8780 hasAssignAction, 8781 hasCreateAction, 8782 hasResolvedTerms 8783 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8784 const { 8785 getCurrentPost, 8786 getEditedPostAttribute 8787 } = select(store_store); 8788 const { 8789 getEntityRecords, 8790 getTaxonomy, 8791 hasFinishedResolution 8792 } = select(external_wp_coreData_namespaceObject.store); 8793 const post = getCurrentPost(); 8794 8795 const _taxonomy = getTaxonomy(slug); 8796 8797 const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; 8798 8799 const query = { ...flat_term_selector_DEFAULT_QUERY, 8800 include: _termIds.join(','), 8801 per_page: -1 8802 }; 8803 return { 8804 hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false, 8805 hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false, 8806 taxonomy: _taxonomy, 8807 termIds: _termIds, 8808 terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY, 8809 hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query]) 8810 }; 8811 }, [slug]); 8812 const { 8813 searchResults 8814 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8815 const { 8816 getEntityRecords 8817 } = select(external_wp_coreData_namespaceObject.store); 8818 return { 8819 searchResults: !!search ? getEntityRecords('taxonomy', slug, { ...flat_term_selector_DEFAULT_QUERY, 8820 search 8821 }) : flat_term_selector_EMPTY_ARRAY 8822 }; 8823 }, [search]); // Update terms state only after the selectors are resolved. 8824 // We're using this to avoid terms temporarily disappearing on slow networks 8825 // while core data makes REST API requests. 8826 8827 (0,external_wp_element_namespaceObject.useEffect)(() => { 8828 if (hasResolvedTerms) { 8829 const newValues = terms.map(term => unescapeString(term.name)); 8830 setValues(newValues); 8831 } 8832 }, [terms, hasResolvedTerms]); 8833 const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { 8834 return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name)); 8835 }, [searchResults]); 8836 const { 8837 editPost 8838 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 8839 8840 if (!hasAssignAction) { 8841 return null; 8842 } 8843 8844 function onUpdateTerms(newTermIds) { 8845 editPost({ 8846 [taxonomy.rest_base]: newTermIds 8847 }); 8848 } 8849 8850 function onChange(termNames) { 8851 const availableTerms = [...terms, ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])]; 8852 const uniqueTerms = (0,external_lodash_namespaceObject.uniqBy)(termNames, term => term.toLowerCase()); 8853 const newTermNames = uniqueTerms.filter(termName => !(0,external_lodash_namespaceObject.find)(availableTerms, term => isSameTermName(term.name, termName))); // Optimistically update term values. 8854 // The selector will always re-fetch terms later. 8855 8856 setValues(uniqueTerms); 8857 8858 if (newTermNames.length === 0) { 8859 return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 8860 } 8861 8862 if (!hasCreateAction) { 8863 return; 8864 } 8865 8866 Promise.all(newTermNames.map(termName => findOrCreateTerm(termName, taxonomy.rest_base))).then(newTerms => { 8867 const newAvailableTerms = availableTerms.concat(newTerms); 8868 return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms)); 8869 }); 8870 } 8871 8872 function appendTerm(newTerm) { 8873 if (termIds.includes(newTerm.id)) { 8874 return; 8875 } 8876 8877 const newTermIds = [...termIds, newTerm.id]; 8878 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 8879 /* translators: %s: term name. */ 8880 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'))); 8881 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); 8882 onUpdateTerms(newTermIds); 8883 } 8884 8885 const newTermLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term')); 8886 const singularName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term')); 8887 const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 8888 /* translators: %s: term name. */ 8889 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName); 8890 const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 8891 /* translators: %s: term name. */ 8892 (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName); 8893 const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 8894 /* translators: %s: term name. */ 8895 (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName); 8896 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, { 8897 value: values, 8898 suggestions: suggestions, 8899 onChange: onChange, 8900 onInputChange: debouncedSearch, 8901 maxSuggestions: MAX_TERMS_SUGGESTIONS, 8902 label: newTermLabel, 8903 messages: { 8904 added: termAddedLabel, 8905 removed: termRemovedLabel, 8906 remove: removeTermLabel 8907 } 8908 }), (0,external_wp_element_namespaceObject.createElement)(MostUsedTerms, { 8909 taxonomy: taxonomy, 8910 onSelect: appendTerm 8911 })); 8912 } 8913 8914 /* harmony default export */ var flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector)); 8915 8916 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js 8917 8918 8919 /** 8920 * External dependencies 8921 */ 8922 8923 /** 8924 * WordPress dependencies 8925 */ 8926 8927 8928 8929 8930 8931 8932 8933 /** 8934 * Internal dependencies 8935 */ 8936 8937 8938 8939 8940 const TagsPanel = () => { 8941 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", { 8942 className: "editor-post-publish-panel__link", 8943 key: "label" 8944 }, (0,external_wp_i18n_namespaceObject.__)('Add tags'))]; 8945 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 8946 initialOpen: false, 8947 title: panelBodyTitle 8948 }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), (0,external_wp_element_namespaceObject.createElement)(flat_term_selector, { 8949 slug: 'post_tag' 8950 })); 8951 }; 8952 8953 class MaybeTagsPanel extends external_wp_element_namespaceObject.Component { 8954 constructor(props) { 8955 super(props); 8956 this.state = { 8957 hadTagsWhenOpeningThePanel: props.hasTags 8958 }; 8959 } 8960 /* 8961 * We only want to show the tag panel if the post didn't have 8962 * any tags when the user hit the Publish button. 8963 * 8964 * We can't use the prop.hasTags because it'll change to true 8965 * if the user adds a new tag within the pre-publish panel. 8966 * This would force a re-render and a new prop.hasTags check, 8967 * hiding this panel and keeping the user from adding 8968 * more than one tag. 8969 */ 8970 8971 8972 render() { 8973 if (!this.state.hadTagsWhenOpeningThePanel) { 8974 return (0,external_wp_element_namespaceObject.createElement)(TagsPanel, null); 8975 } 8976 8977 return null; 8978 } 8979 8980 } 8981 8982 /* harmony default export */ var maybe_tags_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { 8983 const postType = select(store_store).getCurrentPostType(); 8984 const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag'); 8985 const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base); 8986 return { 8987 areTagsFetched: tagsTaxonomy !== undefined, 8988 isPostTypeSupported: tagsTaxonomy && (0,external_lodash_namespaceObject.some)(tagsTaxonomy.types, type => type === postType), 8989 hasTags: tags && tags.length 8990 }; 8991 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref => { 8992 let { 8993 areTagsFetched, 8994 isPostTypeSupported 8995 } = _ref; 8996 return isPostTypeSupported && areTagsFetched; 8997 }))(MaybeTagsPanel)); 8998 8999 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js 9000 9001 9002 /** 9003 * External dependencies 9004 */ 9005 9006 /** 9007 * WordPress dependencies 9008 */ 9009 9010 9011 9012 9013 9014 /** 9015 * Internal dependencies 9016 */ 9017 9018 9019 9020 9021 const getSuggestion = (supportedFormats, suggestedPostFormat) => { 9022 const formats = POST_FORMATS.filter(format => (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id)); 9023 return (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedPostFormat); 9024 }; 9025 9026 const PostFormatSuggestion = _ref => { 9027 let { 9028 suggestedPostFormat, 9029 suggestionText, 9030 onUpdatePostFormat 9031 } = _ref; 9032 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9033 variant: "link", 9034 onClick: () => onUpdatePostFormat(suggestedPostFormat) 9035 }, suggestionText); 9036 }; 9037 9038 function PostFormatPanel() { 9039 const { 9040 currentPostFormat, 9041 suggestion 9042 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9043 const { 9044 getEditedPostAttribute, 9045 getSuggestedPostFormat 9046 } = select(store_store); 9047 const supportedFormats = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getThemeSupports(), ['formats'], []); 9048 return { 9049 currentPostFormat: getEditedPostAttribute('format'), 9050 suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) 9051 }; 9052 }, []); 9053 const { 9054 editPost 9055 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 9056 9057 const onUpdatePostFormat = format => editPost({ 9058 format 9059 }); 9060 9061 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", { 9062 className: "editor-post-publish-panel__link", 9063 key: "label" 9064 }, (0,external_wp_i18n_namespaceObject.__)('Use a post format'))]; 9065 9066 if (!suggestion || suggestion.id === currentPostFormat) { 9067 return null; 9068 } 9069 9070 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 9071 initialOpen: false, 9072 title: panelBodyTitle 9073 }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(PostFormatSuggestion, { 9074 onUpdatePostFormat: onUpdatePostFormat, 9075 suggestedPostFormat: suggestion.id, 9076 suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( 9077 /* translators: %s: post format */ 9078 (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption) 9079 }))); 9080 } 9081 9082 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js 9083 9084 9085 /** 9086 * External dependencies 9087 */ 9088 9089 /** 9090 * WordPress dependencies 9091 */ 9092 9093 9094 9095 9096 9097 9098 9099 9100 /** 9101 * Internal dependencies 9102 */ 9103 9104 9105 9106 /** 9107 * Module Constants 9108 */ 9109 9110 const hierarchical_term_selector_DEFAULT_QUERY = { 9111 per_page: -1, 9112 orderby: 'name', 9113 order: 'asc', 9114 _fields: 'id,name,parent', 9115 context: 'view' 9116 }; 9117 const MIN_TERMS_COUNT_FOR_FILTER = 8; 9118 const hierarchical_term_selector_EMPTY_ARRAY = []; 9119 /** 9120 * Sort Terms by Selected. 9121 * 9122 * @param {Object[]} termsTree Array of terms in tree format. 9123 * @param {number[]} terms Selected terms. 9124 * 9125 * @return {Object[]} Sorted array of terms. 9126 */ 9127 9128 function sortBySelected(termsTree, terms) { 9129 const treeHasSelection = termTree => { 9130 if (terms.indexOf(termTree.id) !== -1) { 9131 return true; 9132 } 9133 9134 if (undefined === termTree.children) { 9135 return false; 9136 } 9137 9138 return termTree.children.map(treeHasSelection).filter(child => child).length > 0; 9139 }; 9140 9141 const termOrChildIsSelected = (termA, termB) => { 9142 const termASelected = treeHasSelection(termA); 9143 const termBSelected = treeHasSelection(termB); 9144 9145 if (termASelected === termBSelected) { 9146 return 0; 9147 } 9148 9149 if (termASelected && !termBSelected) { 9150 return -1; 9151 } 9152 9153 if (!termASelected && termBSelected) { 9154 return 1; 9155 } 9156 9157 return 0; 9158 }; 9159 9160 const newTermTree = [...termsTree]; 9161 newTermTree.sort(termOrChildIsSelected); 9162 return newTermTree; 9163 } 9164 /** 9165 * Find term by parent id or name. 9166 * 9167 * @param {Object[]} terms Array of Terms. 9168 * @param {number|string} parent id. 9169 * @param {string} name Term name. 9170 * @return {Object} Term object. 9171 */ 9172 9173 function findTerm(terms, parent, name) { 9174 return (0,external_lodash_namespaceObject.find)(terms, term => { 9175 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); 9176 }); 9177 } 9178 /** 9179 * Get filter matcher function. 9180 * 9181 * @param {string} filterValue Filter value. 9182 * @return {(function(Object): (Object|boolean))} Matcher function. 9183 */ 9184 9185 function getFilterMatcher(filterValue) { 9186 const matchTermsForFilter = originalTerm => { 9187 if ('' === filterValue) { 9188 return originalTerm; 9189 } // Shallow clone, because we'll be filtering the term's children and 9190 // don't want to modify the original term. 9191 9192 9193 const term = { ...originalTerm 9194 }; // Map and filter the children, recursive so we deal with grandchildren 9195 // and any deeper levels. 9196 9197 if (term.children.length > 0) { 9198 term.children = term.children.map(matchTermsForFilter).filter(child => child); 9199 } // If the term's name contains the filterValue, or it has children 9200 // (i.e. some child matched at some point in the tree) then return it. 9201 9202 9203 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { 9204 return term; 9205 } // Otherwise, return false. After mapping, the list of terms will need 9206 // to have false values filtered out. 9207 9208 9209 return false; 9210 }; 9211 9212 return matchTermsForFilter; 9213 } 9214 /** 9215 * Hierarchical term selector. 9216 * 9217 * @param {Object} props Component props. 9218 * @param {string} props.slug Taxonomy slug. 9219 * @return {WPElement} Hierarchical term selector component. 9220 */ 9221 9222 function HierarchicalTermSelector(_ref) { 9223 let { 9224 slug 9225 } = _ref; 9226 const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); 9227 const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(''); 9228 /** 9229 * @type {[number|'', Function]} 9230 */ 9231 9232 const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(''); 9233 const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); 9234 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 9235 const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); 9236 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 9237 const { 9238 hasCreateAction, 9239 hasAssignAction, 9240 terms, 9241 loading, 9242 availableTerms, 9243 taxonomy 9244 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9245 const { 9246 getCurrentPost, 9247 getEditedPostAttribute 9248 } = select(store_store); 9249 const { 9250 getTaxonomy, 9251 getEntityRecords, 9252 isResolving 9253 } = select(external_wp_coreData_namespaceObject.store); 9254 9255 const _taxonomy = getTaxonomy(slug); 9256 9257 return { 9258 hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false, 9259 hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false, 9260 terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, 9261 loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]), 9262 availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, 9263 taxonomy: _taxonomy 9264 }; 9265 }, [slug]); 9266 const { 9267 editPost 9268 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 9269 const { 9270 saveEntityRecord 9271 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 9272 const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms), // Remove `terms` from the dependency list to avoid reordering every time 9273 // checking or unchecking a term. 9274 [availableTerms]); 9275 9276 if (!hasAssignAction) { 9277 return null; 9278 } 9279 /** 9280 * Append new term. 9281 * 9282 * @param {Object} term Term object. 9283 * @return {Promise} A promise that resolves to save term object. 9284 */ 9285 9286 9287 const addTerm = term => { 9288 return saveEntityRecord('taxonomy', slug, term); 9289 }; 9290 /** 9291 * Update terms for post. 9292 * 9293 * @param {number[]} termIds Term ids. 9294 */ 9295 9296 9297 const onUpdateTerms = termIds => { 9298 editPost({ 9299 [taxonomy.rest_base]: termIds 9300 }); 9301 }; 9302 /** 9303 * Handler for checking term. 9304 * 9305 * @param {number} termId 9306 */ 9307 9308 9309 const onChange = termId => { 9310 const hasTerm = terms.includes(termId); 9311 const newTerms = hasTerm ? (0,external_lodash_namespaceObject.without)(terms, termId) : [...terms, termId]; 9312 onUpdateTerms(newTerms); 9313 }; 9314 9315 const onChangeFormName = value => { 9316 setFormName(value); 9317 }; 9318 /** 9319 * Handler for changing form parent. 9320 * 9321 * @param {number|''} parentId Parent post id. 9322 */ 9323 9324 9325 const onChangeFormParent = parentId => { 9326 setFormParent(parentId); 9327 }; 9328 9329 const onToggleForm = () => { 9330 setShowForm(!showForm); 9331 }; 9332 9333 const onAddTerm = async event => { 9334 event.preventDefault(); 9335 9336 if (formName === '' || adding) { 9337 return; 9338 } // Check if the term we are adding already exists. 9339 9340 9341 const existingTerm = findTerm(availableTerms, formParent, formName); 9342 9343 if (existingTerm) { 9344 // If the term we are adding exists but is not selected select it. 9345 if (!(0,external_lodash_namespaceObject.some)(terms, term => term === existingTerm.id)) { 9346 onUpdateTerms([...terms, existingTerm.id]); 9347 } 9348 9349 setFormName(''); 9350 setFormParent(''); 9351 return; 9352 } 9353 9354 setAdding(true); 9355 const newTerm = await addTerm({ 9356 name: formName, 9357 parent: formParent ? formParent : undefined 9358 }); 9359 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 9360 /* translators: %s: taxonomy name */ 9361 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term'))); 9362 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); 9363 setAdding(false); 9364 setFormName(''); 9365 setFormParent(''); 9366 onUpdateTerms([...terms, newTerm.id]); 9367 }; 9368 9369 const setFilter = value => { 9370 const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term); 9371 9372 const getResultCount = termsTree => { 9373 let count = 0; 9374 9375 for (let i = 0; i < termsTree.length; i++) { 9376 count++; 9377 9378 if (undefined !== termsTree[i].children) { 9379 count += getResultCount(termsTree[i].children); 9380 } 9381 } 9382 9383 return count; 9384 }; 9385 9386 setFilterValue(value); 9387 setFilteredTermsTree(newFilteredTermsTree); 9388 const resultCount = getResultCount(newFilteredTermsTree); 9389 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 9390 /* translators: %d: number of results */ 9391 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount); 9392 debouncedSpeak(resultsFoundMessage, 'assertive'); 9393 }; 9394 9395 const renderTerms = renderedTerms => { 9396 return renderedTerms.map(term => { 9397 return (0,external_wp_element_namespaceObject.createElement)("div", { 9398 key: term.id, 9399 className: "editor-post-taxonomies__hierarchical-terms-choice" 9400 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 9401 checked: terms.indexOf(term.id) !== -1, 9402 onChange: () => { 9403 const termId = parseInt(term.id, 10); 9404 onChange(termId); 9405 }, 9406 label: (0,external_lodash_namespaceObject.unescape)(term.name) 9407 }), !!term.children.length && (0,external_wp_element_namespaceObject.createElement)("div", { 9408 className: "editor-post-taxonomies__hierarchical-terms-subchoices" 9409 }, renderTerms(term.children))); 9410 }); 9411 }; 9412 9413 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); 9414 9415 const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); 9416 const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); 9417 const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term')); 9418 const noParentOption = `— $parentSelectLabel} —`; 9419 const newTermSubmitLabel = newTermButtonLabel; 9420 const filterLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'search_items'], (0,external_wp_i18n_namespaceObject.__)('Search Terms')); 9421 const groupLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['name'], (0,external_wp_i18n_namespaceObject.__)('Terms')); 9422 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; 9423 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showFilter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 9424 className: "editor-post-taxonomies__hierarchical-terms-filter", 9425 label: filterLabel, 9426 value: filterValue, 9427 onChange: setFilter 9428 }), (0,external_wp_element_namespaceObject.createElement)("div", { 9429 className: "editor-post-taxonomies__hierarchical-terms-list", 9430 tabIndex: "0", 9431 role: "group", 9432 "aria-label": groupLabel 9433 }, renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9434 onClick: onToggleForm, 9435 className: "editor-post-taxonomies__hierarchical-terms-add", 9436 "aria-expanded": showForm, 9437 variant: "link" 9438 }, newTermButtonLabel), showForm && (0,external_wp_element_namespaceObject.createElement)("form", { 9439 onSubmit: onAddTerm 9440 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 9441 className: "editor-post-taxonomies__hierarchical-terms-input", 9442 label: newTermLabel, 9443 value: formName, 9444 onChange: onChangeFormName, 9445 required: true 9446 }), !!availableTerms.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TreeSelect, { 9447 label: parentSelectLabel, 9448 noOptionLabel: noParentOption, 9449 onChange: onChangeFormParent, 9450 selectedId: formParent, 9451 tree: availableTermsTree 9452 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9453 variant: "secondary", 9454 type: "submit", 9455 className: "editor-post-taxonomies__hierarchical-terms-submit" 9456 }, newTermSubmitLabel))); 9457 } 9458 9459 /* harmony default export */ var hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector)); 9460 9461 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js 9462 9463 9464 /** 9465 * External dependencies 9466 */ 9467 9468 /** 9469 * WordPress dependencies 9470 */ 9471 9472 9473 9474 9475 9476 9477 /** 9478 * Internal dependencies 9479 */ 9480 9481 9482 9483 9484 function MaybeCategoryPanel() { 9485 const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => { 9486 var _select$getEntityReco; 9487 9488 const postType = select(store_store).getCurrentPostType(); 9489 const categoriesTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('category'); 9490 const defaultCategorySlug = 'uncategorized'; 9491 const defaultCategory = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', 'category', { 9492 slug: defaultCategorySlug 9493 })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco[0]; 9494 const postTypeSupportsCategories = categoriesTaxonomy && (0,external_lodash_namespaceObject.some)(categoriesTaxonomy.types, type => type === postType); 9495 const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded 9496 // ( categoriesTaxonomy, defaultCategory ) 9497 // and the post has not been assigned a category different than "uncategorized". 9498 9499 return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && ((categories === null || categories === void 0 ? void 0 : categories.length) === 0 || (categories === null || categories === void 0 ? void 0 : categories.length) === 1 && defaultCategory.id === categories[0]); 9500 }, []); 9501 const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); 9502 (0,external_wp_element_namespaceObject.useEffect)(() => { 9503 // We use state to avoid hiding the panel if the user edits the categories 9504 // and adds one within the panel itself (while visible). 9505 if (hasNoCategory) { 9506 setShouldShowPanel(true); 9507 } 9508 }, [hasNoCategory]); 9509 9510 if (!shouldShowPanel) { 9511 return null; 9512 } 9513 9514 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", { 9515 className: "editor-post-publish-panel__link", 9516 key: "label" 9517 }, (0,external_wp_i18n_namespaceObject.__)('Assign a category'))]; 9518 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 9519 initialOpen: false, 9520 title: panelBodyTitle 9521 }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')), (0,external_wp_element_namespaceObject.createElement)(hierarchical_term_selector, { 9522 slug: "category" 9523 })); 9524 } 9525 9526 /* harmony default export */ var maybe_category_panel = (MaybeCategoryPanel); 9527 9528 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js 9529 9530 9531 /** 9532 * External dependencies 9533 */ 9534 9535 /** 9536 * WordPress dependencies 9537 */ 9538 9539 9540 9541 9542 9543 9544 9545 9546 /** 9547 * Internal dependencies 9548 */ 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 function PostPublishPanelPrepublish(_ref) { 9560 let { 9561 children 9562 } = _ref; 9563 const { 9564 isBeingScheduled, 9565 isRequestingSiteIcon, 9566 hasPublishAction, 9567 siteIconUrl, 9568 siteTitle, 9569 siteHome 9570 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9571 const { 9572 getCurrentPost, 9573 isEditedPostBeingScheduled 9574 } = select(store_store); 9575 const { 9576 getEntityRecord, 9577 isResolving 9578 } = select(external_wp_coreData_namespaceObject.store); 9579 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 9580 return { 9581 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 9582 isBeingScheduled: isEditedPostBeingScheduled(), 9583 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), 9584 siteIconUrl: siteData.site_icon_url, 9585 siteTitle: siteData.name, 9586 siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) 9587 }; 9588 }, []); 9589 let siteIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 9590 className: "components-site-icon", 9591 size: "36px", 9592 icon: library_wordpress 9593 }); 9594 9595 if (siteIconUrl) { 9596 siteIcon = (0,external_wp_element_namespaceObject.createElement)("img", { 9597 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 9598 className: "components-site-icon", 9599 src: siteIconUrl 9600 }); 9601 } 9602 9603 if (isRequestingSiteIcon) { 9604 siteIcon = null; 9605 } 9606 9607 let prePublishTitle, prePublishBodyText; 9608 9609 if (!hasPublishAction) { 9610 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?'); 9611 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'); 9612 } else if (isBeingScheduled) { 9613 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?'); 9614 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.'); 9615 } else { 9616 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?'); 9617 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.'); 9618 } 9619 9620 return (0,external_wp_element_namespaceObject.createElement)("div", { 9621 className: "editor-post-publish-panel__prepublish" 9622 }, (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("strong", null, prePublishTitle)), (0,external_wp_element_namespaceObject.createElement)("p", null, prePublishBodyText), (0,external_wp_element_namespaceObject.createElement)("div", { 9623 className: "components-site-card" 9624 }, siteIcon, (0,external_wp_element_namespaceObject.createElement)("div", { 9625 className: "components-site-info" 9626 }, (0,external_wp_element_namespaceObject.createElement)("span", { 9627 className: "components-site-name" 9628 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')), (0,external_wp_element_namespaceObject.createElement)("span", { 9629 className: "components-site-home" 9630 }, siteHome))), hasPublishAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 9631 initialOpen: false, 9632 title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), (0,external_wp_element_namespaceObject.createElement)("span", { 9633 className: "editor-post-publish-panel__link", 9634 key: "label" 9635 }, (0,external_wp_element_namespaceObject.createElement)(post_visibility_label, null))] 9636 }, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 9637 initialOpen: false, 9638 title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), (0,external_wp_element_namespaceObject.createElement)("span", { 9639 className: "editor-post-publish-panel__link", 9640 key: "label" 9641 }, (0,external_wp_element_namespaceObject.createElement)(post_schedule_label, null))] 9642 }, (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null))), (0,external_wp_element_namespaceObject.createElement)(PostFormatPanel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_tags_panel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_category_panel, null), children); 9643 } 9644 9645 /* harmony default export */ var prepublish = (PostPublishPanelPrepublish); 9646 9647 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js 9648 9649 9650 /** 9651 * External dependencies 9652 */ 9653 9654 /** 9655 * WordPress dependencies 9656 */ 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 /** 9667 * Internal dependencies 9668 */ 9669 9670 9671 9672 const POSTNAME = '%postname%'; 9673 /** 9674 * Returns URL for a future post. 9675 * 9676 * @param {Object} post Post object. 9677 * 9678 * @return {string} PostPublish URL. 9679 */ 9680 9681 const getFuturePostUrl = post => { 9682 const { 9683 slug 9684 } = post; 9685 9686 if (post.permalink_template.includes(POSTNAME)) { 9687 return post.permalink_template.replace(POSTNAME, slug); 9688 } 9689 9690 return post.permalink_template; 9691 }; 9692 9693 function postpublish_CopyButton(_ref) { 9694 let { 9695 text, 9696 onCopy, 9697 children 9698 } = _ref; 9699 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy); 9700 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9701 variant: "secondary", 9702 ref: ref 9703 }, children); 9704 } 9705 9706 class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component { 9707 constructor() { 9708 super(...arguments); 9709 this.state = { 9710 showCopyConfirmation: false 9711 }; 9712 this.onCopy = this.onCopy.bind(this); 9713 this.onSelectInput = this.onSelectInput.bind(this); 9714 this.postLink = (0,external_wp_element_namespaceObject.createRef)(); 9715 } 9716 9717 componentDidMount() { 9718 if (this.props.focusOnMount) { 9719 this.postLink.current.focus(); 9720 } 9721 } 9722 9723 componentWillUnmount() { 9724 clearTimeout(this.dismissCopyConfirmation); 9725 } 9726 9727 onCopy() { 9728 this.setState({ 9729 showCopyConfirmation: true 9730 }); 9731 clearTimeout(this.dismissCopyConfirmation); 9732 this.dismissCopyConfirmation = setTimeout(() => { 9733 this.setState({ 9734 showCopyConfirmation: false 9735 }); 9736 }, 4000); 9737 } 9738 9739 onSelectInput(event) { 9740 event.target.select(); 9741 } 9742 9743 render() { 9744 const { 9745 children, 9746 isScheduled, 9747 post, 9748 postType 9749 } = this.props; 9750 const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'singular_name']); 9751 const viewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']); 9752 const addNewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'add_new_item']); 9753 const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; 9754 const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', { 9755 post_type: post.type 9756 }); 9757 const postPublishNonLinkHeader = isScheduled ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', (0,external_wp_element_namespaceObject.createElement)(post_schedule_label, null), ".") : (0,external_wp_i18n_namespaceObject.__)('is now live.'); 9758 return (0,external_wp_element_namespaceObject.createElement)("div", { 9759 className: "post-publish-panel__postpublish" 9760 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 9761 className: "post-publish-panel__postpublish-header" 9762 }, (0,external_wp_element_namespaceObject.createElement)("a", { 9763 ref: this.postLink, 9764 href: link 9765 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')), ' ', postPublishNonLinkHeader), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)("p", { 9766 className: "post-publish-panel__postpublish-subheader" 9767 }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('What’s next?'))), (0,external_wp_element_namespaceObject.createElement)("div", { 9768 className: "post-publish-panel__postpublish-post-address-container" 9769 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 9770 className: "post-publish-panel__postpublish-post-address", 9771 readOnly: true, 9772 label: (0,external_wp_i18n_namespaceObject.sprintf)( 9773 /* translators: %s: post type singular name */ 9774 (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel), 9775 value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), 9776 onFocus: this.onSelectInput 9777 }), (0,external_wp_element_namespaceObject.createElement)("div", { 9778 className: "post-publish-panel__postpublish-post-address__copy-button-wrap" 9779 }, (0,external_wp_element_namespaceObject.createElement)(postpublish_CopyButton, { 9780 text: link, 9781 onCopy: this.onCopy 9782 }, this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')))), (0,external_wp_element_namespaceObject.createElement)("div", { 9783 className: "post-publish-panel__postpublish-buttons" 9784 }, !isScheduled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9785 variant: "primary", 9786 href: link 9787 }, viewPostLabel), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9788 variant: isScheduled ? 'primary' : 'secondary', 9789 href: addLink 9790 }, addNewPostLabel))), children); 9791 } 9792 9793 } 9794 9795 /* harmony default export */ var postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => { 9796 const { 9797 getEditedPostAttribute, 9798 getCurrentPost, 9799 isCurrentPostScheduled 9800 } = select(store_store); 9801 const { 9802 getPostType 9803 } = select(external_wp_coreData_namespaceObject.store); 9804 return { 9805 post: getCurrentPost(), 9806 postType: getPostType(getEditedPostAttribute('type')), 9807 isScheduled: isCurrentPostScheduled() 9808 }; 9809 })(PostPublishPanelPostpublish)); 9810 9811 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js 9812 9813 9814 9815 /** 9816 * External dependencies 9817 */ 9818 9819 /** 9820 * WordPress dependencies 9821 */ 9822 9823 9824 9825 9826 9827 9828 9829 9830 /** 9831 * Internal dependencies 9832 */ 9833 9834 9835 9836 9837 9838 class PostPublishPanel extends external_wp_element_namespaceObject.Component { 9839 constructor() { 9840 super(...arguments); 9841 this.onSubmit = this.onSubmit.bind(this); 9842 } 9843 9844 componentDidUpdate(prevProps) { 9845 // Automatically collapse the publish sidebar when a post 9846 // is published and the user makes an edit. 9847 if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) { 9848 this.props.onClose(); 9849 } 9850 } 9851 9852 onSubmit() { 9853 const { 9854 onClose, 9855 hasPublishAction, 9856 isPostTypeViewable 9857 } = this.props; 9858 9859 if (!hasPublishAction || !isPostTypeViewable) { 9860 onClose(); 9861 } 9862 } 9863 9864 render() { 9865 const { 9866 forceIsDirty, 9867 forceIsSaving, 9868 isBeingScheduled, 9869 isPublished, 9870 isPublishSidebarEnabled, 9871 isScheduled, 9872 isSaving, 9873 isSavingNonPostEntityChanges, 9874 onClose, 9875 onTogglePublishSidebar, 9876 PostPublishExtension, 9877 PrePublishExtension, 9878 ...additionalProps 9879 } = this.props; 9880 const propsForPanel = (0,external_lodash_namespaceObject.omit)(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); 9881 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; 9882 const isPrePublish = !isPublishedOrScheduled && !isSaving; 9883 const isPostPublish = isPublishedOrScheduled && !isSaving; 9884 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ 9885 className: "editor-post-publish-panel" 9886 }, propsForPanel), (0,external_wp_element_namespaceObject.createElement)("div", { 9887 className: "editor-post-publish-panel__header" 9888 }, isPostPublish ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9889 onClick: onClose, 9890 icon: close_small, 9891 label: (0,external_wp_i18n_namespaceObject.__)('Close panel') 9892 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { 9893 className: "editor-post-publish-panel__header-publish-button" 9894 }, (0,external_wp_element_namespaceObject.createElement)(post_publish_button, { 9895 focusOnMount: true, 9896 onSubmit: this.onSubmit, 9897 forceIsDirty: forceIsDirty, 9898 forceIsSaving: forceIsSaving 9899 })), (0,external_wp_element_namespaceObject.createElement)("div", { 9900 className: "editor-post-publish-panel__header-cancel-button" 9901 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9902 disabled: isSavingNonPostEntityChanges, 9903 onClick: onClose, 9904 variant: "secondary" 9905 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))))), (0,external_wp_element_namespaceObject.createElement)("div", { 9906 className: "editor-post-publish-panel__content" 9907 }, isPrePublish && (0,external_wp_element_namespaceObject.createElement)(prepublish, null, PrePublishExtension && (0,external_wp_element_namespaceObject.createElement)(PrePublishExtension, null)), isPostPublish && (0,external_wp_element_namespaceObject.createElement)(postpublish, { 9908 focusOnMount: true 9909 }, PostPublishExtension && (0,external_wp_element_namespaceObject.createElement)(PostPublishExtension, null)), isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_wp_element_namespaceObject.createElement)("div", { 9910 className: "editor-post-publish-panel__footer" 9911 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 9912 label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'), 9913 checked: isPublishSidebarEnabled, 9914 onChange: onTogglePublishSidebar 9915 }))); 9916 } 9917 9918 } 9919 /* harmony default export */ var post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 9920 const { 9921 getPostType 9922 } = select(external_wp_coreData_namespaceObject.store); 9923 const { 9924 getCurrentPost, 9925 getEditedPostAttribute, 9926 isCurrentPostPublished, 9927 isCurrentPostScheduled, 9928 isEditedPostBeingScheduled, 9929 isEditedPostDirty, 9930 isSavingPost, 9931 isSavingNonPostEntityChanges 9932 } = select(store_store); 9933 const { 9934 isPublishSidebarEnabled 9935 } = select(store_store); 9936 const postType = getPostType(getEditedPostAttribute('type')); 9937 return { 9938 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 9939 isPostTypeViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false), 9940 isBeingScheduled: isEditedPostBeingScheduled(), 9941 isDirty: isEditedPostDirty(), 9942 isPublished: isCurrentPostPublished(), 9943 isPublishSidebarEnabled: isPublishSidebarEnabled(), 9944 isSaving: isSavingPost(), 9945 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), 9946 isScheduled: isCurrentPostScheduled() 9947 }; 9948 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref) => { 9949 let { 9950 isPublishSidebarEnabled 9951 } = _ref; 9952 const { 9953 disablePublishSidebar, 9954 enablePublishSidebar 9955 } = dispatch(store_store); 9956 return { 9957 onTogglePublishSidebar: () => { 9958 if (isPublishSidebarEnabled) { 9959 disablePublishSidebar(); 9960 } else { 9961 enablePublishSidebar(); 9962 } 9963 } 9964 }; 9965 }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel)); 9966 9967 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js 9968 9969 9970 /** 9971 * WordPress dependencies 9972 */ 9973 9974 const cloudUpload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 9975 xmlns: "http://www.w3.org/2000/svg", 9976 viewBox: "0 0 24 24" 9977 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 9978 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" 9979 })); 9980 /* harmony default export */ var cloud_upload = (cloudUpload); 9981 9982 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 9983 /** 9984 * WordPress dependencies 9985 */ 9986 9987 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 9988 9989 /** 9990 * Return an SVG icon. 9991 * 9992 * @param {IconProps} props icon is the SVG component to render 9993 * size is a number specifiying the icon size in pixels 9994 * Other props will be passed to wrapped SVG component 9995 * 9996 * @return {JSX.Element} Icon component 9997 */ 9998 9999 function Icon(_ref) { 10000 let { 10001 icon, 10002 size = 24, 10003 ...props 10004 } = _ref; 10005 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 10006 width: size, 10007 height: size, 10008 ...props 10009 }); 10010 } 10011 10012 /* harmony default export */ var icon = (Icon); 10013 10014 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 10015 10016 10017 /** 10018 * WordPress dependencies 10019 */ 10020 10021 const check_check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 10022 xmlns: "http://www.w3.org/2000/svg", 10023 viewBox: "0 0 24 24" 10024 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 10025 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 10026 })); 10027 /* harmony default export */ var library_check = (check_check); 10028 10029 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js 10030 10031 10032 /** 10033 * WordPress dependencies 10034 */ 10035 10036 const cloud = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 10037 xmlns: "http://www.w3.org/2000/svg", 10038 viewBox: "0 0 24 24" 10039 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 10040 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" 10041 })); 10042 /* harmony default export */ var library_cloud = (cloud); 10043 10044 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js 10045 10046 10047 /** 10048 * WordPress dependencies 10049 */ 10050 10051 10052 10053 10054 10055 /** 10056 * Internal dependencies 10057 */ 10058 10059 10060 10061 function PostSwitchToDraftButton(_ref) { 10062 let { 10063 isSaving, 10064 isPublished, 10065 isScheduled, 10066 onClick 10067 } = _ref; 10068 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 10069 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 10070 10071 if (!isPublished && !isScheduled) { 10072 return null; 10073 } 10074 10075 let alertMessage; 10076 10077 if (isPublished) { 10078 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?'); 10079 } else if (isScheduled) { 10080 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?'); 10081 } 10082 10083 const handleConfirm = () => { 10084 setShowConfirmDialog(false); 10085 onClick(); 10086 }; 10087 10088 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10089 className: "editor-post-switch-to-draft", 10090 onClick: () => { 10091 setShowConfirmDialog(true); 10092 }, 10093 disabled: isSaving, 10094 variant: "tertiary" 10095 }, isMobileViewport ? (0,external_wp_i18n_namespaceObject.__)('Draft') : (0,external_wp_i18n_namespaceObject.__)('Switch to draft')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 10096 isOpen: showConfirmDialog, 10097 onConfirm: handleConfirm, 10098 onCancel: () => setShowConfirmDialog(false) 10099 }, alertMessage)); 10100 } 10101 10102 /* harmony default export */ var post_switch_to_draft_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10103 const { 10104 isSavingPost, 10105 isCurrentPostPublished, 10106 isCurrentPostScheduled 10107 } = select(store_store); 10108 return { 10109 isSaving: isSavingPost(), 10110 isPublished: isCurrentPostPublished(), 10111 isScheduled: isCurrentPostScheduled() 10112 }; 10113 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 10114 const { 10115 editPost, 10116 savePost 10117 } = dispatch(store_store); 10118 return { 10119 onClick: () => { 10120 editPost({ 10121 status: 'draft' 10122 }); 10123 savePost(); 10124 } 10125 }; 10126 })])(PostSwitchToDraftButton)); 10127 10128 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js 10129 10130 10131 /** 10132 * External dependencies 10133 */ 10134 10135 /** 10136 * WordPress dependencies 10137 */ 10138 10139 10140 10141 10142 10143 10144 10145 10146 /** 10147 * Internal dependencies 10148 */ 10149 10150 10151 10152 /** 10153 * Component showing whether the post is saved or not and providing save 10154 * buttons. 10155 * 10156 * @param {Object} props Component props. 10157 * @param {?boolean} props.forceIsDirty Whether to force the post to be marked 10158 * as dirty. 10159 * @param {?boolean} props.forceIsSaving Whether to force the post to be marked 10160 * as being saved. 10161 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons 10162 * @return {import('@wordpress/element').WPComponent} The component. 10163 */ 10164 10165 function PostSavedState(_ref) { 10166 let { 10167 forceIsDirty, 10168 forceIsSaving, 10169 showIconLabels = false 10170 } = _ref; 10171 const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); 10172 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); 10173 const { 10174 isAutosaving, 10175 isDirty, 10176 isNew, 10177 isPending, 10178 isPublished, 10179 isSaveable, 10180 isSaving, 10181 isScheduled, 10182 hasPublishAction 10183 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10184 var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2; 10185 10186 const { 10187 isEditedPostNew, 10188 isCurrentPostPublished, 10189 isCurrentPostScheduled, 10190 isEditedPostDirty, 10191 isSavingPost, 10192 isEditedPostSaveable, 10193 getCurrentPost, 10194 isAutosavingPost, 10195 getEditedPostAttribute 10196 } = select(store_store); 10197 return { 10198 isAutosaving: isAutosavingPost(), 10199 isDirty: forceIsDirty || isEditedPostDirty(), 10200 isNew: isEditedPostNew(), 10201 isPending: 'pending' === getEditedPostAttribute('status'), 10202 isPublished: isCurrentPostPublished(), 10203 isSaving: forceIsSaving || isSavingPost(), 10204 isSaveable: isEditedPostSaveable(), 10205 isScheduled: isCurrentPostScheduled(), 10206 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 10207 }; 10208 }, [forceIsDirty, forceIsSaving]); 10209 const { 10210 savePost 10211 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10212 const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); 10213 (0,external_wp_element_namespaceObject.useEffect)(() => { 10214 let timeoutId; 10215 10216 if (wasSaving && !isSaving) { 10217 setForceSavedMessage(true); 10218 timeoutId = setTimeout(() => { 10219 setForceSavedMessage(false); 10220 }, 1000); 10221 } 10222 10223 return () => clearTimeout(timeoutId); 10224 }, [isSaving]); // Once the post has been submitted for review this button 10225 // is not needed for the contributor role. 10226 10227 if (!hasPublishAction && isPending) { 10228 return null; 10229 } 10230 10231 if (isPublished || isScheduled) { 10232 return (0,external_wp_element_namespaceObject.createElement)(post_switch_to_draft_button, null); 10233 } 10234 /* translators: button label text should, if possible, be under 16 characters. */ 10235 10236 10237 const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft'); 10238 /* translators: button label text should, if possible, be under 16 characters. */ 10239 10240 const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save'); 10241 10242 const isSaved = forceSavedMessage || !isNew && !isDirty; 10243 const isSavedState = isSaving || isSaved; 10244 const isDisabled = isSaving || isSaved || !isSaveable; 10245 let text; 10246 10247 if (isSaving) { 10248 text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving'); 10249 } else if (isSaved) { 10250 text = (0,external_wp_i18n_namespaceObject.__)('Saved'); 10251 } else if (isLargeViewport) { 10252 text = label; 10253 } else if (showIconLabels) { 10254 text = shortLabel; 10255 } // Use common Button instance for all saved states so that focus is not 10256 // lost. 10257 10258 10259 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10260 className: isSaveable || isSaving ? classnames_default()({ 10261 'editor-post-save-draft': !isSavedState, 10262 'editor-post-saved-state': isSavedState, 10263 'is-saving': isSaving, 10264 'is-autosaving': isAutosaving, 10265 'is-saved': isSaved, 10266 [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ 10267 type: 'loading' 10268 })]: isSaving 10269 }) : undefined, 10270 onClick: isDisabled ? undefined : () => savePost(), 10271 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('s'), 10272 variant: isLargeViewport ? 'tertiary' : undefined, 10273 icon: isLargeViewport ? undefined : cloud_upload, 10274 label: showIconLabels ? undefined : label, 10275 "aria-disabled": isDisabled 10276 }, isSavedState && (0,external_wp_element_namespaceObject.createElement)(icon, { 10277 icon: isSaved ? library_check : library_cloud 10278 }), text); 10279 } 10280 10281 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js 10282 /** 10283 * External dependencies 10284 */ 10285 10286 /** 10287 * WordPress dependencies 10288 */ 10289 10290 10291 10292 /** 10293 * Internal dependencies 10294 */ 10295 10296 10297 function PostScheduleCheck(_ref) { 10298 let { 10299 hasPublishAction, 10300 children 10301 } = _ref; 10302 10303 if (!hasPublishAction) { 10304 return null; 10305 } 10306 10307 return children; 10308 } 10309 /* harmony default export */ var post_schedule_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10310 const { 10311 getCurrentPost, 10312 getCurrentPostType 10313 } = select(store_store); 10314 return { 10315 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 10316 postType: getCurrentPostType() 10317 }; 10318 })])(PostScheduleCheck)); 10319 10320 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js 10321 10322 10323 /** 10324 * Internal dependencies 10325 */ 10326 10327 function PostSlugCheck(_ref) { 10328 let { 10329 children 10330 } = _ref; 10331 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { 10332 supportKeys: "slug" 10333 }, children); 10334 } 10335 10336 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js 10337 10338 10339 /** 10340 * WordPress dependencies 10341 */ 10342 10343 10344 10345 10346 10347 /** 10348 * Internal dependencies 10349 */ 10350 10351 10352 10353 class PostSlug extends external_wp_element_namespaceObject.Component { 10354 constructor(_ref) { 10355 let { 10356 postSlug, 10357 postTitle, 10358 postID 10359 } = _ref; 10360 super(...arguments); 10361 this.state = { 10362 editedSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postSlug) || (0,external_wp_url_namespaceObject.cleanForSlug)(postTitle) || postID 10363 }; 10364 this.setSlug = this.setSlug.bind(this); 10365 } 10366 10367 setSlug(event) { 10368 const { 10369 postSlug, 10370 onUpdateSlug 10371 } = this.props; 10372 const { 10373 value 10374 } = event.target; 10375 const editedSlug = (0,external_wp_url_namespaceObject.cleanForSlug)(value); 10376 10377 if (editedSlug === postSlug) { 10378 return; 10379 } 10380 10381 onUpdateSlug(editedSlug); 10382 } 10383 10384 render() { 10385 const { 10386 instanceId 10387 } = this.props; 10388 const { 10389 editedSlug 10390 } = this.state; 10391 const inputId = 'editor-post-slug-' + instanceId; 10392 return (0,external_wp_element_namespaceObject.createElement)(PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)("label", { 10393 htmlFor: inputId 10394 }, (0,external_wp_i18n_namespaceObject.__)('Slug')), (0,external_wp_element_namespaceObject.createElement)("input", { 10395 autoComplete: "off", 10396 spellCheck: "false", 10397 type: "text", 10398 id: inputId, 10399 value: editedSlug, 10400 onChange: event => this.setState({ 10401 editedSlug: event.target.value 10402 }), 10403 onBlur: this.setSlug, 10404 className: "editor-post-slug__input" 10405 })); 10406 } 10407 10408 } 10409 /* harmony default export */ var post_slug = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10410 const { 10411 getCurrentPost, 10412 getEditedPostAttribute 10413 } = select(store_store); 10414 const { 10415 id 10416 } = getCurrentPost(); 10417 return { 10418 postSlug: getEditedPostAttribute('slug'), 10419 postTitle: getEditedPostAttribute('title'), 10420 postID: id 10421 }; 10422 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 10423 const { 10424 editPost 10425 } = dispatch(store_store); 10426 return { 10427 onUpdateSlug(slug) { 10428 editPost({ 10429 slug 10430 }); 10431 } 10432 10433 }; 10434 }), external_wp_compose_namespaceObject.withInstanceId])(PostSlug)); 10435 10436 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js 10437 /** 10438 * External dependencies 10439 */ 10440 10441 /** 10442 * WordPress dependencies 10443 */ 10444 10445 10446 10447 /** 10448 * Internal dependencies 10449 */ 10450 10451 10452 function PostStickyCheck(_ref) { 10453 let { 10454 hasStickyAction, 10455 postType, 10456 children 10457 } = _ref; 10458 10459 if (postType !== 'post' || !hasStickyAction) { 10460 return null; 10461 } 10462 10463 return children; 10464 } 10465 /* harmony default export */ var post_sticky_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10466 const post = select(store_store).getCurrentPost(); 10467 return { 10468 hasStickyAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-sticky'], false), 10469 postType: select(store_store).getCurrentPostType() 10470 }; 10471 })])(PostStickyCheck)); 10472 10473 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js 10474 10475 10476 /** 10477 * WordPress dependencies 10478 */ 10479 10480 10481 10482 10483 /** 10484 * Internal dependencies 10485 */ 10486 10487 10488 10489 function PostSticky(_ref) { 10490 let { 10491 onUpdateSticky, 10492 postSticky = false 10493 } = _ref; 10494 return (0,external_wp_element_namespaceObject.createElement)(post_sticky_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { 10495 label: (0,external_wp_i18n_namespaceObject.__)('Stick to the top of the blog'), 10496 checked: postSticky, 10497 onChange: () => onUpdateSticky(!postSticky) 10498 })); 10499 } 10500 /* harmony default export */ var post_sticky = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10501 return { 10502 postSticky: select(store_store).getEditedPostAttribute('sticky') 10503 }; 10504 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 10505 return { 10506 onUpdateSticky(postSticky) { 10507 dispatch(store_store).editPost({ 10508 sticky: postSticky 10509 }); 10510 } 10511 10512 }; 10513 })])(PostSticky)); 10514 10515 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js 10516 10517 10518 /** 10519 * External dependencies 10520 */ 10521 10522 /** 10523 * WordPress dependencies 10524 */ 10525 10526 10527 10528 10529 10530 /** 10531 * Internal dependencies 10532 */ 10533 10534 10535 10536 10537 function PostTaxonomies(_ref) { 10538 let { 10539 postType, 10540 taxonomies, 10541 taxonomyWrapper = external_lodash_namespaceObject.identity 10542 } = _ref; 10543 const availableTaxonomies = (0,external_lodash_namespaceObject.filter)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType)); 10544 const visibleTaxonomies = (0,external_lodash_namespaceObject.filter)(availableTaxonomies, // In some circumstances .visibility can end up as undefined so optional chaining operator required. 10545 // https://github.com/WordPress/gutenberg/issues/40326 10546 taxonomy => { 10547 var _taxonomy$visibility; 10548 10549 return (_taxonomy$visibility = taxonomy.visibility) === null || _taxonomy$visibility === void 0 ? void 0 : _taxonomy$visibility.show_ui; 10550 }); 10551 return visibleTaxonomies.map(taxonomy => { 10552 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; 10553 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { 10554 key: `taxonomy-$taxonomy.slug}` 10555 }, taxonomyWrapper((0,external_wp_element_namespaceObject.createElement)(TaxonomyComponent, { 10556 slug: taxonomy.slug 10557 }), taxonomy)); 10558 }); 10559 } 10560 /* harmony default export */ var post_taxonomies = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10561 return { 10562 postType: select(store_store).getCurrentPostType(), 10563 taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 10564 per_page: -1 10565 }) 10566 }; 10567 })])(PostTaxonomies)); 10568 10569 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js 10570 /** 10571 * External dependencies 10572 */ 10573 10574 /** 10575 * WordPress dependencies 10576 */ 10577 10578 10579 10580 10581 /** 10582 * Internal dependencies 10583 */ 10584 10585 10586 function PostTaxonomiesCheck(_ref) { 10587 let { 10588 postType, 10589 taxonomies, 10590 children 10591 } = _ref; 10592 const hasTaxonomies = (0,external_lodash_namespaceObject.some)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType)); 10593 10594 if (!hasTaxonomies) { 10595 return null; 10596 } 10597 10598 return children; 10599 } 10600 /* harmony default export */ var post_taxonomies_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 10601 return { 10602 postType: select(store_store).getCurrentPostType(), 10603 taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 10604 per_page: -1 10605 }) 10606 }; 10607 })])(PostTaxonomiesCheck)); 10608 10609 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 10610 var lib = __webpack_require__(773); 10611 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js 10612 10613 10614 /** 10615 * External dependencies 10616 */ 10617 10618 /** 10619 * WordPress dependencies 10620 */ 10621 10622 10623 10624 10625 10626 10627 10628 /** 10629 * Internal dependencies 10630 */ 10631 10632 10633 function PostTextEditor() { 10634 const postContent = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostContent(), []); 10635 const { 10636 editPost, 10637 resetEditorBlocks 10638 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10639 const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(postContent); 10640 const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false); 10641 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); 10642 10643 if (!isDirty && value !== postContent) { 10644 setValue(postContent); 10645 } 10646 /** 10647 * Handles a textarea change event to notify the onChange prop callback and 10648 * reflect the new value in the component's own state. This marks the start 10649 * of the user's edits, if not already changed, preventing future props 10650 * changes to value from replacing the rendered value. This is expected to 10651 * be followed by a reset to dirty state via `stopEditing`. 10652 * 10653 * @see stopEditing 10654 * 10655 * @param {Event} event Change event. 10656 */ 10657 10658 10659 const onChange = event => { 10660 const newValue = event.target.value; 10661 editPost({ 10662 content: newValue 10663 }); 10664 setValue(newValue); 10665 setIsDirty(true); 10666 }; 10667 /** 10668 * Function called when the user has completed their edits, responsible for 10669 * ensuring that changes, if made, are surfaced to the onPersist prop 10670 * callback and resetting dirty state. 10671 */ 10672 10673 10674 const stopEditing = () => { 10675 if (isDirty) { 10676 const blocks = (0,external_wp_blocks_namespaceObject.parse)(value); 10677 resetEditorBlocks(blocks); 10678 setIsDirty(false); 10679 } 10680 }; 10681 10682 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 10683 as: "label", 10684 htmlFor: `post-content-$instanceId}` 10685 }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, { 10686 autoComplete: "off", 10687 dir: "auto", 10688 value: value, 10689 onChange: onChange, 10690 onBlur: stopEditing, 10691 className: "editor-post-text-editor", 10692 id: `post-content-$instanceId}`, 10693 placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') 10694 })); 10695 } 10696 10697 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js 10698 10699 10700 /** 10701 * External dependencies 10702 */ 10703 10704 /** 10705 * WordPress dependencies 10706 */ 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 /** 10718 * Internal dependencies 10719 */ 10720 10721 10722 10723 /** 10724 * Constants 10725 */ 10726 10727 const REGEXP_NEWLINES = /[\r\n]+/g; 10728 function PostTitle() { 10729 const ref = (0,external_wp_element_namespaceObject.useRef)(); 10730 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 10731 const { 10732 editPost 10733 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10734 const { 10735 insertDefaultBlock, 10736 clearSelectedBlock, 10737 insertBlocks 10738 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 10739 const { 10740 isCleanNewPost, 10741 title, 10742 placeholder, 10743 isFocusMode, 10744 hasFixedToolbar 10745 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10746 const { 10747 getEditedPostAttribute, 10748 isCleanNewPost: _isCleanNewPost 10749 } = select(store_store); 10750 const { 10751 getSettings 10752 } = select(external_wp_blockEditor_namespaceObject.store); 10753 const { 10754 titlePlaceholder, 10755 focusMode, 10756 hasFixedToolbar: _hasFixedToolbar 10757 } = getSettings(); 10758 return { 10759 isCleanNewPost: _isCleanNewPost(), 10760 title: getEditedPostAttribute('title'), 10761 placeholder: titlePlaceholder, 10762 isFocusMode: focusMode, 10763 hasFixedToolbar: _hasFixedToolbar 10764 }; 10765 }, []); 10766 (0,external_wp_element_namespaceObject.useEffect)(() => { 10767 if (!ref.current) { 10768 return; 10769 } 10770 10771 const { 10772 ownerDocument 10773 } = ref.current; 10774 const { 10775 activeElement, 10776 body 10777 } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should 10778 // only happen for a new post, which means we focus the title on new 10779 // post so the author can start typing right away, without needing to 10780 // click anything. 10781 10782 if (isCleanNewPost && (!activeElement || body === activeElement)) { 10783 ref.current.focus(); 10784 } 10785 }, [isCleanNewPost]); 10786 10787 function onEnterPress() { 10788 insertDefaultBlock(undefined, undefined, 0); 10789 } 10790 10791 function onInsertBlockAfter(blocks) { 10792 insertBlocks(blocks, 0); 10793 } 10794 10795 function onUpdate(newTitle) { 10796 editPost({ 10797 title: newTitle 10798 }); 10799 } 10800 10801 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); 10802 10803 function onSelect() { 10804 setIsSelected(true); 10805 clearSelectedBlock(); 10806 } 10807 10808 function onUnselect() { 10809 setIsSelected(false); 10810 setSelection({}); 10811 } 10812 10813 function onChange(value) { 10814 onUpdate(value.replace(REGEXP_NEWLINES, ' ')); 10815 } 10816 10817 function onKeyDown(event) { 10818 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 10819 event.preventDefault(); 10820 onEnterPress(); 10821 } 10822 } 10823 10824 function onPaste(event) { 10825 const clipboardData = event.clipboardData; 10826 let plainText = ''; 10827 let html = ''; // IE11 only supports `Text` as an argument for `getData` and will 10828 // otherwise throw an invalid argument error, so we try the standard 10829 // arguments first, then fallback to `Text` if they fail. 10830 10831 try { 10832 plainText = clipboardData.getData('text/plain'); 10833 html = clipboardData.getData('text/html'); 10834 } catch (error1) { 10835 try { 10836 html = clipboardData.getData('Text'); 10837 } catch (error2) { 10838 // Some browsers like UC Browser paste plain text by default and 10839 // don't support clipboardData at all, so allow default 10840 // behaviour. 10841 return; 10842 } 10843 } // Allows us to ask for this information when we get a report. 10844 10845 10846 window.console.log('Received HTML:\n\n', html); 10847 window.console.log('Received plain text:\n\n', plainText); 10848 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 10849 HTML: html, 10850 plainText 10851 }); 10852 10853 if (typeof content !== 'string' && content.length) { 10854 event.preventDefault(); 10855 const [firstBlock] = content; 10856 10857 if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { 10858 onUpdate(firstBlock.attributes.content); 10859 onInsertBlockAfter(content.slice(1)); 10860 } else { 10861 onInsertBlockAfter(content); 10862 } 10863 } 10864 } // The wp-block className is important for editor styles. 10865 // This same block is used in both the visual and the code editor. 10866 10867 10868 const className = classnames_default()('wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text', { 10869 'is-selected': isSelected, 10870 'is-focus-mode': isFocusMode, 10871 'has-fixed-toolbar': hasFixedToolbar 10872 }); 10873 10874 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); 10875 10876 const { 10877 ref: richTextRef 10878 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ 10879 value: title, 10880 onChange, 10881 placeholder: decodedPlaceholder, 10882 selectionStart: selection.start, 10883 selectionEnd: selection.end, 10884 10885 onSelectionChange(newStart, newEnd) { 10886 setSelection(sel => { 10887 const { 10888 start, 10889 end 10890 } = sel; 10891 10892 if (start === newStart && end === newEnd) { 10893 return sel; 10894 } 10895 10896 return { 10897 start: newStart, 10898 end: newEnd 10899 }; 10900 }); 10901 }, 10902 10903 __unstableDisableFormats: true, 10904 preserveWhiteSpace: true 10905 }); 10906 /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ 10907 10908 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { 10909 supportKeys: "title" 10910 }, (0,external_wp_element_namespaceObject.createElement)("h1", { 10911 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, ref]), 10912 contentEditable: true, 10913 className: className, 10914 "aria-label": decodedPlaceholder, 10915 role: "textbox", 10916 "aria-multiline": "true", 10917 onFocus: onSelect, 10918 onBlur: onUnselect, 10919 onKeyDown: onKeyDown, 10920 onKeyPress: onUnselect, 10921 onPaste: onPaste 10922 })); 10923 /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ 10924 } 10925 10926 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js 10927 10928 10929 /** 10930 * WordPress dependencies 10931 */ 10932 10933 10934 10935 /** 10936 * Internal dependencies 10937 */ 10938 10939 10940 function PostTrash() { 10941 const { 10942 isNew, 10943 postId 10944 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10945 const store = select(store_store); 10946 return { 10947 isNew: store.isEditedPostNew(), 10948 postId: store.getCurrentPostId() 10949 }; 10950 }, []); 10951 const { 10952 trashPost 10953 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10954 10955 if (isNew || !postId) { 10956 return null; 10957 } 10958 10959 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10960 className: "editor-post-trash", 10961 isDestructive: true, 10962 variant: "secondary", 10963 onClick: () => trashPost() 10964 }, (0,external_wp_i18n_namespaceObject.__)('Move to trash')); 10965 } 10966 10967 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js 10968 /** 10969 * WordPress dependencies 10970 */ 10971 10972 10973 /** 10974 * Internal dependencies 10975 */ 10976 10977 10978 10979 function PostTrashCheck(_ref) { 10980 let { 10981 isNew, 10982 postId, 10983 canUserDelete, 10984 children 10985 } = _ref; 10986 10987 if (isNew || !postId || !canUserDelete) { 10988 return null; 10989 } 10990 10991 return children; 10992 } 10993 10994 /* harmony default export */ var post_trash_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { 10995 const { 10996 isEditedPostNew, 10997 getCurrentPostId, 10998 getCurrentPostType 10999 } = select(store_store); 11000 const { 11001 getPostType, 11002 canUser 11003 } = select(external_wp_coreData_namespaceObject.store); 11004 const postId = getCurrentPostId(); 11005 const postType = getPostType(getCurrentPostType()); 11006 const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase 11007 11008 return { 11009 isNew: isEditedPostNew(), 11010 postId, 11011 canUserDelete: postId && resource ? canUser('delete', resource, postId) : false 11012 }; 11013 })(PostTrashCheck)); 11014 11015 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js 11016 /** 11017 * External dependencies 11018 */ 11019 11020 /** 11021 * WordPress dependencies 11022 */ 11023 11024 11025 11026 /** 11027 * Internal dependencies 11028 */ 11029 11030 11031 function PostVisibilityCheck(_ref) { 11032 let { 11033 hasPublishAction, 11034 render 11035 } = _ref; 11036 const canEdit = hasPublishAction; 11037 return render({ 11038 canEdit 11039 }); 11040 } 11041 /* harmony default export */ var post_visibility_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 11042 const { 11043 getCurrentPost, 11044 getCurrentPostType 11045 } = select(store_store); 11046 return { 11047 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), 11048 postType: getCurrentPostType() 11049 }; 11050 })])(PostVisibilityCheck)); 11051 11052 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js 11053 11054 11055 /** 11056 * WordPress dependencies 11057 */ 11058 11059 const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 11060 xmlns: "http://www.w3.org/2000/svg", 11061 viewBox: "0 0 24 24" 11062 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 11063 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" 11064 })); 11065 /* harmony default export */ var library_info = (info); 11066 11067 ;// CONCATENATED MODULE: external ["wp","wordcount"] 11068 var external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; 11069 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js 11070 11071 11072 /** 11073 * WordPress dependencies 11074 */ 11075 11076 11077 11078 /** 11079 * Internal dependencies 11080 */ 11081 11082 11083 function WordCount() { 11084 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 11085 /* 11086 * translators: If your word count is based on single characters (e.g. East Asian characters), 11087 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 11088 * Do not translate into your own language. 11089 */ 11090 11091 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 11092 11093 return (0,external_wp_element_namespaceObject.createElement)("span", { 11094 className: "word-count" 11095 }, (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType)); 11096 } 11097 11098 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js 11099 /** 11100 * WordPress dependencies 11101 */ 11102 11103 11104 /** 11105 * Internal dependencies 11106 */ 11107 11108 11109 function CharacterCount() { 11110 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 11111 return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces'); 11112 } 11113 11114 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js 11115 11116 11117 /** 11118 * WordPress dependencies 11119 */ 11120 11121 11122 11123 /** 11124 * Internal dependencies 11125 */ 11126 11127 11128 11129 11130 11131 function TableOfContentsPanel(_ref) { 11132 let { 11133 hasOutlineItemsDisabled, 11134 onRequestClose 11135 } = _ref; 11136 const { 11137 headingCount, 11138 paragraphCount, 11139 numberOfBlocks 11140 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11141 const { 11142 getGlobalBlockCount 11143 } = select(external_wp_blockEditor_namespaceObject.store); 11144 return { 11145 headingCount: getGlobalBlockCount('core/heading'), 11146 paragraphCount: getGlobalBlockCount('core/paragraph'), 11147 numberOfBlocks: getGlobalBlockCount() 11148 }; 11149 }, []); 11150 return ( 11151 /* 11152 * Disable reason: The `list` ARIA role is redundant but 11153 * Safari+VoiceOver won't announce the list otherwise. 11154 */ 11155 11156 /* eslint-disable jsx-a11y/no-redundant-roles */ 11157 (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { 11158 className: "table-of-contents__wrapper", 11159 role: "note", 11160 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'), 11161 tabIndex: "0" 11162 }, (0,external_wp_element_namespaceObject.createElement)("ul", { 11163 role: "list", 11164 className: "table-of-contents__counts" 11165 }, (0,external_wp_element_namespaceObject.createElement)("li", { 11166 className: "table-of-contents__count" 11167 }, (0,external_wp_i18n_namespaceObject.__)('Characters'), (0,external_wp_element_namespaceObject.createElement)("span", { 11168 className: "table-of-contents__number" 11169 }, (0,external_wp_element_namespaceObject.createElement)(CharacterCount, null))), (0,external_wp_element_namespaceObject.createElement)("li", { 11170 className: "table-of-contents__count" 11171 }, (0,external_wp_i18n_namespaceObject.__)('Words'), (0,external_wp_element_namespaceObject.createElement)(WordCount, null)), (0,external_wp_element_namespaceObject.createElement)("li", { 11172 className: "table-of-contents__count" 11173 }, (0,external_wp_i18n_namespaceObject.__)('Headings'), (0,external_wp_element_namespaceObject.createElement)("span", { 11174 className: "table-of-contents__number" 11175 }, headingCount)), (0,external_wp_element_namespaceObject.createElement)("li", { 11176 className: "table-of-contents__count" 11177 }, (0,external_wp_i18n_namespaceObject.__)('Paragraphs'), (0,external_wp_element_namespaceObject.createElement)("span", { 11178 className: "table-of-contents__number" 11179 }, paragraphCount)), (0,external_wp_element_namespaceObject.createElement)("li", { 11180 className: "table-of-contents__count" 11181 }, (0,external_wp_i18n_namespaceObject.__)('Blocks'), (0,external_wp_element_namespaceObject.createElement)("span", { 11182 className: "table-of-contents__number" 11183 }, numberOfBlocks)))), headingCount > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("hr", null), (0,external_wp_element_namespaceObject.createElement)("h2", { 11184 className: "table-of-contents__title" 11185 }, (0,external_wp_i18n_namespaceObject.__)('Document Outline')), (0,external_wp_element_namespaceObject.createElement)(document_outline, { 11186 onSelect: onRequestClose, 11187 hasOutlineItemsDisabled: hasOutlineItemsDisabled 11188 }))) 11189 /* eslint-enable jsx-a11y/no-redundant-roles */ 11190 11191 ); 11192 } 11193 11194 /* harmony default export */ var panel = (TableOfContentsPanel); 11195 11196 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js 11197 11198 11199 11200 /** 11201 * WordPress dependencies 11202 */ 11203 11204 11205 11206 11207 11208 11209 /** 11210 * Internal dependencies 11211 */ 11212 11213 11214 11215 function TableOfContents(_ref, ref) { 11216 let { 11217 hasOutlineItemsDisabled, 11218 repositionDropdown, 11219 ...props 11220 } = _ref; 11221 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []); 11222 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { 11223 position: repositionDropdown ? 'middle right right' : 'bottom', 11224 className: "table-of-contents", 11225 contentClassName: "table-of-contents__popover", 11226 renderToggle: _ref2 => { 11227 let { 11228 isOpen, 11229 onToggle 11230 } = _ref2; 11231 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { 11232 ref: ref, 11233 onClick: hasBlocks ? onToggle : undefined, 11234 icon: library_info, 11235 "aria-expanded": isOpen, 11236 "aria-haspopup": "true" 11237 /* translators: button label text should, if possible, be under 16 characters. */ 11238 , 11239 label: (0,external_wp_i18n_namespaceObject.__)('Details'), 11240 tooltipPosition: "bottom", 11241 "aria-disabled": !hasBlocks 11242 })); 11243 }, 11244 renderContent: _ref3 => { 11245 let { 11246 onClose 11247 } = _ref3; 11248 return (0,external_wp_element_namespaceObject.createElement)(panel, { 11249 onRequestClose: onClose, 11250 hasOutlineItemsDisabled: hasOutlineItemsDisabled 11251 }); 11252 } 11253 }); 11254 } 11255 11256 /* harmony default export */ var table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents)); 11257 11258 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js 11259 /** 11260 * WordPress dependencies 11261 */ 11262 11263 11264 11265 11266 /** 11267 * Warns the user if there are unsaved changes before leaving the editor. 11268 * Compatible with Post Editor and Site Editor. 11269 * 11270 * @return {WPComponent} The component. 11271 */ 11272 11273 function UnsavedChangesWarning() { 11274 const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => { 11275 return () => { 11276 const { 11277 __experimentalGetDirtyEntityRecords 11278 } = select(external_wp_coreData_namespaceObject.store); 11279 11280 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 11281 11282 return dirtyEntityRecords.length > 0; 11283 }; 11284 }, []); 11285 /** 11286 * Warns the user if there are unsaved changes before leaving the editor. 11287 * 11288 * @param {Event} event `beforeunload` event. 11289 * 11290 * @return {?string} Warning prompt message, if unsaved changes exist. 11291 */ 11292 11293 const warnIfUnsavedChanges = event => { 11294 // We need to call the selector directly in the listener to avoid race 11295 // conditions with `BrowserURL` where `componentDidUpdate` gets the 11296 // new value of `isEditedPostDirty` before this component does, 11297 // causing this component to incorrectly think a trashed post is still dirty. 11298 if (isDirty()) { 11299 event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); 11300 return event.returnValue; 11301 } 11302 }; 11303 11304 (0,external_wp_element_namespaceObject.useEffect)(() => { 11305 window.addEventListener('beforeunload', warnIfUnsavedChanges); 11306 return () => { 11307 window.removeEventListener('beforeunload', warnIfUnsavedChanges); 11308 }; 11309 }, []); 11310 return null; 11311 } 11312 11313 ;// CONCATENATED MODULE: external ["wp","reusableBlocks"] 11314 var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"]; 11315 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js 11316 11317 11318 /** 11319 * WordPress dependencies 11320 */ 11321 11322 11323 11324 11325 /** 11326 * Internal dependencies 11327 */ 11328 11329 11330 const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_data_namespaceObject.withRegistry)(props => { 11331 const { 11332 useSubRegistry = true, 11333 registry, 11334 ...additionalProps 11335 } = props; 11336 11337 if (!useSubRegistry) { 11338 return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps); 11339 } 11340 11341 const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null); 11342 (0,external_wp_element_namespaceObject.useEffect)(() => { 11343 const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({ 11344 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig 11345 }, registry); 11346 newRegistry.registerStore('core/editor', storeConfig); 11347 setSubRegistry(newRegistry); 11348 }, [registry]); 11349 11350 if (!subRegistry) { 11351 return null; 11352 } 11353 11354 return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, { 11355 value: subRegistry 11356 }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps)); 11357 }), 'withRegistryProvider'); 11358 /* harmony default export */ var with_registry_provider = (withRegistryProvider); 11359 11360 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] 11361 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 11362 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js 11363 /** 11364 * External dependencies 11365 */ 11366 11367 /** 11368 * WordPress dependencies 11369 */ 11370 11371 11372 11373 /** 11374 * Internal dependencies 11375 */ 11376 11377 11378 /** 11379 * Upload a media file when the file upload button is activated. 11380 * Wrapper around mediaUpload() that injects the current post ID. 11381 * 11382 * @param {Object} $0 Parameters object passed to the function. 11383 * @param {?Object} $0.additionalData Additional data to include in the request. 11384 * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. 11385 * @param {Array} $0.filesList List of files. 11386 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. 11387 * @param {Function} $0.onError Function called when an error happens. 11388 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. 11389 */ 11390 11391 function mediaUpload(_ref) { 11392 let { 11393 additionalData = {}, 11394 allowedTypes, 11395 filesList, 11396 maxUploadFileSize, 11397 onError = external_lodash_namespaceObject.noop, 11398 onFileChange 11399 } = _ref; 11400 const { 11401 getCurrentPostId, 11402 getEditorSettings 11403 } = (0,external_wp_data_namespaceObject.select)(store_store); 11404 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; 11405 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; 11406 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ 11407 allowedTypes, 11408 filesList, 11409 onFileChange, 11410 additionalData: { 11411 post: getCurrentPostId(), 11412 ...additionalData 11413 }, 11414 maxUploadFileSize, 11415 onError: _ref2 => { 11416 let { 11417 message 11418 } = _ref2; 11419 return onError(message); 11420 }, 11421 wpAllowedMimeTypes 11422 }); 11423 } 11424 11425 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js 11426 /** 11427 * External dependencies 11428 */ 11429 11430 /** 11431 * WordPress dependencies 11432 */ 11433 11434 11435 11436 11437 11438 /** 11439 * Internal dependencies 11440 */ 11441 11442 11443 11444 /** 11445 * React hook used to compute the block editor settings to use for the post editor. 11446 * 11447 * @param {Object} settings EditorProvider settings prop. 11448 * @param {boolean} hasTemplate Whether template mode is enabled. 11449 * 11450 * @return {Object} Block Editor Settings. 11451 */ 11452 11453 function useBlockEditorSettings(settings, hasTemplate) { 11454 const { 11455 reusableBlocks, 11456 hasUploadPermissions, 11457 canUseUnfilteredHTML, 11458 userCanCreatePages, 11459 pageOnFront 11460 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11461 const { 11462 canUserUseUnfilteredHTML 11463 } = select(store_store); 11464 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; 11465 const { 11466 canUser, 11467 getEntityRecord 11468 } = select(external_wp_coreData_namespaceObject.store); 11469 const siteSettings = getEntityRecord('root', 'site'); 11470 return { 11471 canUseUnfilteredHTML: canUserUseUnfilteredHTML(), 11472 reusableBlocks: isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { 11473 per_page: -1 11474 }) : [], 11475 // Reusable blocks are fetched in the native version of this hook. 11476 hasUploadPermissions: (0,external_lodash_namespaceObject.defaultTo)(canUser('create', 'media'), true), 11477 userCanCreatePages: canUser('create', 'pages'), 11478 pageOnFront: siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_on_front 11479 }; 11480 }, []); 11481 const { 11482 __experimentalBlockPatterns: settingsBlockPatterns, 11483 __experimentalBlockPatternCategories: settingsBlockPatternCategories 11484 } = settings; 11485 const { 11486 blockPatterns, 11487 blockPatternCategories 11488 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 11489 blockPatterns: settingsBlockPatterns !== null && settingsBlockPatterns !== void 0 ? settingsBlockPatterns : select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), 11490 blockPatternCategories: settingsBlockPatternCategories !== null && settingsBlockPatternCategories !== void 0 ? settingsBlockPatternCategories : select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories() 11491 }), [settingsBlockPatterns, settingsBlockPatternCategories]); 11492 const { 11493 undo 11494 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11495 const { 11496 saveEntityRecord 11497 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 11498 /** 11499 * Creates a Post entity. 11500 * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages. 11501 * 11502 * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord. 11503 * @return {Object} the post type object that was created. 11504 */ 11505 11506 const createPageEntity = options => { 11507 if (!userCanCreatePages) { 11508 return Promise.reject({ 11509 message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.') 11510 }); 11511 } 11512 11513 return saveEntityRecord('postType', 'page', options); 11514 }; 11515 11516 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(0,external_lodash_namespaceObject.pick)(settings, ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets']), 11517 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, 11518 __experimentalReusableBlocks: reusableBlocks, 11519 __experimentalBlockPatterns: blockPatterns, 11520 __experimentalBlockPatternCategories: blockPatternCategories, 11521 __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), 11522 __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, 11523 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, 11524 __experimentalUndo: undo, 11525 outlineMode: hasTemplate, 11526 __experimentalCreatePageEntity: createPageEntity, 11527 __experimentalUserCanCreatePages: userCanCreatePages, 11528 pageOnFront, 11529 __experimentalPreferPatternsOnRoot: hasTemplate 11530 }), [settings, hasUploadPermissions, reusableBlocks, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, userCanCreatePages, pageOnFront]); 11531 } 11532 11533 /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings); 11534 11535 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js 11536 11537 11538 /** 11539 * WordPress dependencies 11540 */ 11541 11542 11543 11544 11545 11546 11547 11548 /** 11549 * Internal dependencies 11550 */ 11551 11552 11553 11554 11555 11556 function EditorProvider(_ref) { 11557 let { 11558 __unstableTemplate, 11559 post, 11560 settings, 11561 recovery, 11562 initialEdits, 11563 children 11564 } = _ref; 11565 const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { 11566 if (post.type === 'wp_template') { 11567 return {}; 11568 } 11569 11570 return { 11571 postId: post.id, 11572 postType: post.type 11573 }; 11574 }, [post.id, post.type]); 11575 const { 11576 selection, 11577 isReady 11578 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11579 const { 11580 getEditorSelection, 11581 __unstableIsEditorReady 11582 } = select(store_store); 11583 return { 11584 isReady: __unstableIsEditorReady(), 11585 selection: getEditorSelection() 11586 }; 11587 }, []); 11588 const { 11589 id, 11590 type 11591 } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post; 11592 const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', type, { 11593 id 11594 }); 11595 const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate); 11596 const { 11597 updatePostLock, 11598 setupEditor, 11599 updateEditorSettings, 11600 __experimentalTearDownEditor 11601 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11602 const { 11603 createWarningNotice 11604 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // Initialize and tear down the editor. 11605 // Ideally this should be synced on each change and not just something you do once. 11606 11607 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11608 // Assume that we don't need to initialize in the case of an error recovery. 11609 if (recovery) { 11610 return; 11611 } 11612 11613 updatePostLock(settings.postLock); 11614 setupEditor(post, initialEdits, settings.template); 11615 11616 if (settings.autosave) { 11617 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), { 11618 id: 'autosave-exists', 11619 actions: [{ 11620 label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'), 11621 url: settings.autosave.editLink 11622 }] 11623 }); 11624 } 11625 11626 return () => { 11627 __experimentalTearDownEditor(); 11628 }; 11629 }, []); // Synchronize the editor settings as they change. 11630 11631 (0,external_wp_element_namespaceObject.useEffect)(() => { 11632 updateEditorSettings(settings); 11633 }, [settings]); 11634 11635 if (!isReady) { 11636 return null; 11637 } 11638 11639 return (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { 11640 kind: "root", 11641 type: "site" 11642 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { 11643 kind: "postType", 11644 type: post.type, 11645 id: post.id 11646 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { 11647 value: defaultBlockContext 11648 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 11649 value: blocks, 11650 onChange: onChange, 11651 onInput: onInput, 11652 selection: selection, 11653 settings: editorSettings, 11654 useSubRegistry: false 11655 }, children, (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null))))); 11656 } 11657 11658 /* harmony default export */ var provider = (with_registry_provider(EditorProvider)); 11659 11660 ;// CONCATENATED MODULE: external ["wp","serverSideRender"] 11661 var external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; 11662 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); 11663 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js 11664 11665 11666 // Block Creation Components. 11667 11668 /** 11669 * WordPress dependencies 11670 */ 11671 11672 11673 11674 11675 11676 function deprecateComponent(name, Wrapped) { 11677 let staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; 11678 const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 11679 external_wp_deprecated_default()('wp.editor.' + name, { 11680 since: '5.3', 11681 alternative: 'wp.blockEditor.' + name, 11682 version: '6.2' 11683 }); 11684 return (0,external_wp_element_namespaceObject.createElement)(Wrapped, _extends({ 11685 ref: ref 11686 }, props)); 11687 }); 11688 staticsToHoist.forEach(staticName => { 11689 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); 11690 }); 11691 return Component; 11692 } 11693 11694 function deprecateFunction(name, func) { 11695 return function () { 11696 external_wp_deprecated_default()('wp.editor.' + name, { 11697 since: '5.3', 11698 alternative: 'wp.blockEditor.' + name, 11699 version: '6.2' 11700 }); 11701 return func(...arguments); 11702 }; 11703 } 11704 11705 const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']); 11706 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty); 11707 11708 const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete); 11709 const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar); 11710 const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar); 11711 const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']); 11712 const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit); 11713 const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts); 11714 const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']); 11715 const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon); 11716 const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector); 11717 const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList); 11718 const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover); 11719 const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown); 11720 const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer); 11721 const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu); 11722 const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle); 11723 const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar); 11724 const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette); 11725 const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker); 11726 const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler); 11727 const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender); 11728 const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker); 11729 const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter); 11730 const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); 11731 const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']); 11732 const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']); 11733 const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings); 11734 const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText); 11735 const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut); 11736 const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton); 11737 const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent); 11738 const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder); 11739 const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload); 11740 const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck); 11741 const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView); 11742 const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar); 11743 const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping); 11744 const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock); 11745 const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput); 11746 const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton); 11747 const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover); 11748 const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning); 11749 const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow); 11750 const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC); 11751 const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName); 11752 const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues); 11753 const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue); 11754 const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize); 11755 const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass); 11756 const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext); 11757 const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors); 11758 const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes); 11759 11760 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js 11761 // Block Creation Components. 11762 // Post Related Components. 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 // State Related Components. 11825 11826 11827 11828 11829 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js 11830 /** 11831 * WordPress dependencies 11832 */ 11833 11834 11835 /** 11836 * Performs some basic cleanup of a string for use as a post slug 11837 * 11838 * This replicates some of what sanitize_title() does in WordPress core, but 11839 * is only designed to approximate what the slug will be. 11840 * 11841 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. 11842 * Removes combining diacritical marks. Converts whitespace, periods, 11843 * and forward slashes to hyphens. Removes any remaining non-word characters 11844 * except hyphens and underscores. Converts remaining string to lowercase. 11845 * It does not account for octets, HTML entities, or other encoded characters. 11846 * 11847 * @param {string} string Title or slug to be processed 11848 * 11849 * @return {string} Processed string 11850 */ 11851 11852 function cleanForSlug(string) { 11853 external_wp_deprecated_default()('wp.editor.cleanForSlug', { 11854 since: '12.7', 11855 plugin: 'Gutenberg', 11856 alternative: 'wp.url.cleanForSlug' 11857 }); 11858 return (0,external_wp_url_namespaceObject.cleanForSlug)(string); 11859 } 11860 11861 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js 11862 /** 11863 * Internal dependencies 11864 */ 11865 11866 11867 11868 11869 11870 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js 11871 /** 11872 * Internal dependencies 11873 */ 11874 11875 11876 11877 11878 /* 11879 * Backward compatibility 11880 */ 11881 11882 11883 11884 }(); 11885 (window.wp = window.wp || {}).editor = __webpack_exports__; 11886 /******/ })() 11887 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |