[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 4306: 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 /***/ 6109: 294 /***/ ((module) => { 295 296 // This code has been refactored for 140 bytes 297 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 298 var computedStyle = function (el, prop, getComputedStyle) { 299 getComputedStyle = window.getComputedStyle; 300 301 // In one fell swoop 302 return ( 303 // If we have getComputedStyle 304 getComputedStyle ? 305 // Query it 306 // TODO: From CSS-Query notes, we might need (node, null) for FF 307 getComputedStyle(el) : 308 309 // Otherwise, we are in IE and use currentStyle 310 el.currentStyle 311 )[ 312 // Switch to camelCase for CSSOM 313 // DEV: Grabbed from jQuery 314 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 315 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 316 prop.replace(/-(\w)/gi, function (word, letter) { 317 return letter.toUpperCase(); 318 }) 319 ]; 320 }; 321 322 module.exports = computedStyle; 323 324 325 /***/ }), 326 327 /***/ 66: 328 /***/ ((module) => { 329 330 "use strict"; 331 332 333 var isMergeableObject = function isMergeableObject(value) { 334 return isNonNullObject(value) 335 && !isSpecial(value) 336 }; 337 338 function isNonNullObject(value) { 339 return !!value && typeof value === 'object' 340 } 341 342 function isSpecial(value) { 343 var stringValue = Object.prototype.toString.call(value); 344 345 return stringValue === '[object RegExp]' 346 || stringValue === '[object Date]' 347 || isReactElement(value) 348 } 349 350 // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 351 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; 352 var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; 353 354 function isReactElement(value) { 355 return value.$$typeof === REACT_ELEMENT_TYPE 356 } 357 358 function emptyTarget(val) { 359 return Array.isArray(val) ? [] : {} 360 } 361 362 function cloneUnlessOtherwiseSpecified(value, options) { 363 return (options.clone !== false && options.isMergeableObject(value)) 364 ? deepmerge(emptyTarget(value), value, options) 365 : value 366 } 367 368 function defaultArrayMerge(target, source, options) { 369 return target.concat(source).map(function(element) { 370 return cloneUnlessOtherwiseSpecified(element, options) 371 }) 372 } 373 374 function getMergeFunction(key, options) { 375 if (!options.customMerge) { 376 return deepmerge 377 } 378 var customMerge = options.customMerge(key); 379 return typeof customMerge === 'function' ? customMerge : deepmerge 380 } 381 382 function getEnumerableOwnPropertySymbols(target) { 383 return Object.getOwnPropertySymbols 384 ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 385 return Object.propertyIsEnumerable.call(target, symbol) 386 }) 387 : [] 388 } 389 390 function getKeys(target) { 391 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) 392 } 393 394 function propertyIsOnObject(object, property) { 395 try { 396 return property in object 397 } catch(_) { 398 return false 399 } 400 } 401 402 // Protects from prototype poisoning and unexpected merging up the prototype chain. 403 function propertyIsUnsafe(target, key) { 404 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, 405 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, 406 && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. 407 } 408 409 function mergeObject(target, source, options) { 410 var destination = {}; 411 if (options.isMergeableObject(target)) { 412 getKeys(target).forEach(function(key) { 413 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 414 }); 415 } 416 getKeys(source).forEach(function(key) { 417 if (propertyIsUnsafe(target, key)) { 418 return 419 } 420 421 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 422 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 423 } else { 424 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 425 } 426 }); 427 return destination 428 } 429 430 function deepmerge(target, source, options) { 431 options = options || {}; 432 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 433 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 434 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() 435 // implementations can use it. The caller may not replace it. 436 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 437 438 var sourceIsArray = Array.isArray(source); 439 var targetIsArray = Array.isArray(target); 440 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 441 442 if (!sourceAndTargetTypesMatch) { 443 return cloneUnlessOtherwiseSpecified(source, options) 444 } else if (sourceIsArray) { 445 return options.arrayMerge(target, source, options) 446 } else { 447 return mergeObject(target, source, options) 448 } 449 } 450 451 deepmerge.all = function deepmergeAll(array, options) { 452 if (!Array.isArray(array)) { 453 throw new Error('first argument should be an array') 454 } 455 456 return array.reduce(function(prev, next) { 457 return deepmerge(prev, next, options) 458 }, {}) 459 }; 460 461 var deepmerge_1 = deepmerge; 462 463 module.exports = deepmerge_1; 464 465 466 /***/ }), 467 468 /***/ 5215: 469 /***/ ((module) => { 470 471 "use strict"; 472 473 474 // do not edit .js files directly - edit src/index.jst 475 476 477 478 module.exports = function equal(a, b) { 479 if (a === b) return true; 480 481 if (a && b && typeof a == 'object' && typeof b == 'object') { 482 if (a.constructor !== b.constructor) return false; 483 484 var length, i, keys; 485 if (Array.isArray(a)) { 486 length = a.length; 487 if (length != b.length) return false; 488 for (i = length; i-- !== 0;) 489 if (!equal(a[i], b[i])) return false; 490 return true; 491 } 492 493 494 495 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 496 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 497 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 498 499 keys = Object.keys(a); 500 length = keys.length; 501 if (length !== Object.keys(b).length) return false; 502 503 for (i = length; i-- !== 0;) 504 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 505 506 for (i = length; i-- !== 0;) { 507 var key = keys[i]; 508 509 if (!equal(a[key], b[key])) return false; 510 } 511 512 return true; 513 } 514 515 // true if both NaN, false otherwise 516 return a!==a && b!==b; 517 }; 518 519 520 /***/ }), 521 522 /***/ 461: 523 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 524 525 // Load in dependencies 526 var computedStyle = __webpack_require__(6109); 527 528 /** 529 * Calculate the `line-height` of a given node 530 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 531 * @returns {Number} `line-height` of the element in pixels 532 */ 533 function lineHeight(node) { 534 // Grab the line-height via style 535 var lnHeightStr = computedStyle(node, 'line-height'); 536 var lnHeight = parseFloat(lnHeightStr, 10); 537 538 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 539 if (lnHeightStr === lnHeight + '') { 540 // Save the old lineHeight style and update the em unit to the element 541 var _lnHeightStyle = node.style.lineHeight; 542 node.style.lineHeight = lnHeightStr + 'em'; 543 544 // Calculate the em based height 545 lnHeightStr = computedStyle(node, 'line-height'); 546 lnHeight = parseFloat(lnHeightStr, 10); 547 548 // Revert the lineHeight style 549 if (_lnHeightStyle) { 550 node.style.lineHeight = _lnHeightStyle; 551 } else { 552 delete node.style.lineHeight; 553 } 554 } 555 556 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 557 // DEV: `em` units are converted to `pt` in IE6 558 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 559 if (lnHeightStr.indexOf('pt') !== -1) { 560 lnHeight *= 4; 561 lnHeight /= 3; 562 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 563 } else if (lnHeightStr.indexOf('mm') !== -1) { 564 lnHeight *= 96; 565 lnHeight /= 25.4; 566 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 567 } else if (lnHeightStr.indexOf('cm') !== -1) { 568 lnHeight *= 96; 569 lnHeight /= 2.54; 570 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 571 } else if (lnHeightStr.indexOf('in') !== -1) { 572 lnHeight *= 96; 573 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 574 } else if (lnHeightStr.indexOf('pc') !== -1) { 575 lnHeight *= 16; 576 } 577 578 // Continue our computation 579 lnHeight = Math.round(lnHeight); 580 581 // If the line-height is "normal", calculate by font-size 582 if (lnHeightStr === 'normal') { 583 // Create a temporary node 584 var nodeName = node.nodeName; 585 var _node = document.createElement(nodeName); 586 _node.innerHTML = ' '; 587 588 // If we have a text area, reset it to only 1 row 589 // https://github.com/twolfson/line-height/issues/4 590 if (nodeName.toUpperCase() === 'TEXTAREA') { 591 _node.setAttribute('rows', '1'); 592 } 593 594 // Set the font-size of the element 595 var fontSizeStr = computedStyle(node, 'font-size'); 596 _node.style.fontSize = fontSizeStr; 597 598 // Remove default padding/border which can affect offset height 599 // https://github.com/twolfson/line-height/issues/4 600 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 601 _node.style.padding = '0px'; 602 _node.style.border = '0px'; 603 604 // Append it to the body 605 var body = document.body; 606 body.appendChild(_node); 607 608 // Assume the line height of the element is the height 609 var height = _node.offsetHeight; 610 lnHeight = height; 611 612 // Remove our child from the DOM 613 body.removeChild(_node); 614 } 615 616 // Return the calculated height 617 return lnHeight; 618 } 619 620 // Export lineHeight 621 module.exports = lineHeight; 622 623 624 /***/ }), 625 626 /***/ 628: 627 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 628 629 "use strict"; 630 /** 631 * Copyright (c) 2013-present, Facebook, Inc. 632 * 633 * This source code is licensed under the MIT license found in the 634 * LICENSE file in the root directory of this source tree. 635 */ 636 637 638 639 var ReactPropTypesSecret = __webpack_require__(4067); 640 641 function emptyFunction() {} 642 function emptyFunctionWithReset() {} 643 emptyFunctionWithReset.resetWarningCache = emptyFunction; 644 645 module.exports = function() { 646 function shim(props, propName, componentName, location, propFullName, secret) { 647 if (secret === ReactPropTypesSecret) { 648 // It is still safe when called from React. 649 return; 650 } 651 var err = new Error( 652 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 653 'Use PropTypes.checkPropTypes() to call them. ' + 654 'Read more at http://fb.me/use-check-prop-types' 655 ); 656 err.name = 'Invariant Violation'; 657 throw err; 658 }; 659 shim.isRequired = shim; 660 function getShim() { 661 return shim; 662 }; 663 // Important! 664 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 665 var ReactPropTypes = { 666 array: shim, 667 bigint: shim, 668 bool: shim, 669 func: shim, 670 number: shim, 671 object: shim, 672 string: shim, 673 symbol: shim, 674 675 any: shim, 676 arrayOf: getShim, 677 element: shim, 678 elementType: shim, 679 instanceOf: getShim, 680 node: shim, 681 objectOf: getShim, 682 oneOf: getShim, 683 oneOfType: getShim, 684 shape: getShim, 685 exact: getShim, 686 687 checkPropTypes: emptyFunctionWithReset, 688 resetWarningCache: emptyFunction 689 }; 690 691 ReactPropTypes.PropTypes = ReactPropTypes; 692 693 return ReactPropTypes; 694 }; 695 696 697 /***/ }), 698 699 /***/ 5826: 700 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 701 702 /** 703 * Copyright (c) 2013-present, Facebook, Inc. 704 * 705 * This source code is licensed under the MIT license found in the 706 * LICENSE file in the root directory of this source tree. 707 */ 708 709 if (false) { var throwOnDirectAccess, ReactIs; } else { 710 // By explicitly using `prop-types` you are opting into new production behavior. 711 // http://fb.me/prop-types-in-prod 712 module.exports = __webpack_require__(628)(); 713 } 714 715 716 /***/ }), 717 718 /***/ 4067: 719 /***/ ((module) => { 720 721 "use strict"; 722 /** 723 * Copyright (c) 2013-present, Facebook, Inc. 724 * 725 * This source code is licensed under the MIT license found in the 726 * LICENSE file in the root directory of this source tree. 727 */ 728 729 730 731 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 732 733 module.exports = ReactPropTypesSecret; 734 735 736 /***/ }), 737 738 /***/ 4462: 739 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 740 741 "use strict"; 742 743 var __extends = (this && this.__extends) || (function () { 744 var extendStatics = Object.setPrototypeOf || 745 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 746 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 747 return function (d, b) { 748 extendStatics(d, b); 749 function __() { this.constructor = d; } 750 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 751 }; 752 })(); 753 var __assign = (this && this.__assign) || Object.assign || function(t) { 754 for (var s, i = 1, n = arguments.length; i < n; i++) { 755 s = arguments[i]; 756 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 757 t[p] = s[p]; 758 } 759 return t; 760 }; 761 var __rest = (this && this.__rest) || function (s, e) { 762 var t = {}; 763 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 764 t[p] = s[p]; 765 if (s != null && typeof Object.getOwnPropertySymbols === "function") 766 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 767 t[p[i]] = s[p[i]]; 768 return t; 769 }; 770 exports.__esModule = true; 771 var React = __webpack_require__(1609); 772 var PropTypes = __webpack_require__(5826); 773 var autosize = __webpack_require__(4306); 774 var _getLineHeight = __webpack_require__(461); 775 var getLineHeight = _getLineHeight; 776 var RESIZED = "autosize:resized"; 777 /** 778 * A light replacement for built-in textarea component 779 * which automaticaly adjusts its height to match the content 780 */ 781 var TextareaAutosizeClass = /** @class */ (function (_super) { 782 __extends(TextareaAutosizeClass, _super); 783 function TextareaAutosizeClass() { 784 var _this = _super !== null && _super.apply(this, arguments) || this; 785 _this.state = { 786 lineHeight: null 787 }; 788 _this.textarea = null; 789 _this.onResize = function (e) { 790 if (_this.props.onResize) { 791 _this.props.onResize(e); 792 } 793 }; 794 _this.updateLineHeight = function () { 795 if (_this.textarea) { 796 _this.setState({ 797 lineHeight: getLineHeight(_this.textarea) 798 }); 799 } 800 }; 801 _this.onChange = function (e) { 802 var onChange = _this.props.onChange; 803 _this.currentValue = e.currentTarget.value; 804 onChange && onChange(e); 805 }; 806 return _this; 807 } 808 TextareaAutosizeClass.prototype.componentDidMount = function () { 809 var _this = this; 810 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 811 if (typeof maxRows === "number") { 812 this.updateLineHeight(); 813 } 814 if (typeof maxRows === "number" || async) { 815 /* 816 the defer is needed to: 817 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 818 - support StyledComponents (see #71) 819 */ 820 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 821 } 822 else { 823 this.textarea && autosize(this.textarea); 824 } 825 if (this.textarea) { 826 this.textarea.addEventListener(RESIZED, this.onResize); 827 } 828 }; 829 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 830 if (this.textarea) { 831 this.textarea.removeEventListener(RESIZED, this.onResize); 832 autosize.destroy(this.textarea); 833 } 834 }; 835 TextareaAutosizeClass.prototype.render = function () { 836 var _this = this; 837 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; 838 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 839 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 840 _this.textarea = element; 841 if (typeof _this.props.innerRef === 'function') { 842 _this.props.innerRef(element); 843 } 844 else if (_this.props.innerRef) { 845 _this.props.innerRef.current = element; 846 } 847 } }), children)); 848 }; 849 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 850 this.textarea && autosize.update(this.textarea); 851 }; 852 TextareaAutosizeClass.defaultProps = { 853 rows: 1, 854 async: false 855 }; 856 TextareaAutosizeClass.propTypes = { 857 rows: PropTypes.number, 858 maxRows: PropTypes.number, 859 onResize: PropTypes.func, 860 innerRef: PropTypes.any, 861 async: PropTypes.bool 862 }; 863 return TextareaAutosizeClass; 864 }(React.Component)); 865 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 866 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 867 }); 868 869 870 /***/ }), 871 872 /***/ 4132: 873 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 874 875 "use strict"; 876 var __webpack_unused_export__; 877 878 __webpack_unused_export__ = true; 879 var TextareaAutosize_1 = __webpack_require__(4462); 880 exports.A = TextareaAutosize_1.TextareaAutosize; 881 882 883 /***/ }), 884 885 /***/ 9681: 886 /***/ ((module) => { 887 888 var characterMap = { 889 "À": "A", 890 "Á": "A", 891 "Â": "A", 892 "Ã": "A", 893 "Ä": "A", 894 "Å": "A", 895 "Ấ": "A", 896 "Ắ": "A", 897 "Ẳ": "A", 898 "Ẵ": "A", 899 "Ặ": "A", 900 "Æ": "AE", 901 "Ầ": "A", 902 "Ằ": "A", 903 "Ȃ": "A", 904 "Ả": "A", 905 "Ạ": "A", 906 "Ẩ": "A", 907 "Ẫ": "A", 908 "Ậ": "A", 909 "Ç": "C", 910 "Ḉ": "C", 911 "È": "E", 912 "É": "E", 913 "Ê": "E", 914 "Ë": "E", 915 "Ế": "E", 916 "Ḗ": "E", 917 "Ề": "E", 918 "Ḕ": "E", 919 "Ḝ": "E", 920 "Ȇ": "E", 921 "Ẻ": "E", 922 "Ẽ": "E", 923 "Ẹ": "E", 924 "Ể": "E", 925 "Ễ": "E", 926 "Ệ": "E", 927 "Ì": "I", 928 "Í": "I", 929 "Î": "I", 930 "Ï": "I", 931 "Ḯ": "I", 932 "Ȋ": "I", 933 "Ỉ": "I", 934 "Ị": "I", 935 "Ð": "D", 936 "Ñ": "N", 937 "Ò": "O", 938 "Ó": "O", 939 "Ô": "O", 940 "Õ": "O", 941 "Ö": "O", 942 "Ø": "O", 943 "Ố": "O", 944 "Ṍ": "O", 945 "Ṓ": "O", 946 "Ȏ": "O", 947 "Ỏ": "O", 948 "Ọ": "O", 949 "Ổ": "O", 950 "Ỗ": "O", 951 "Ộ": "O", 952 "Ờ": "O", 953 "Ở": "O", 954 "Ỡ": "O", 955 "Ớ": "O", 956 "Ợ": "O", 957 "Ù": "U", 958 "Ú": "U", 959 "Û": "U", 960 "Ü": "U", 961 "Ủ": "U", 962 "Ụ": "U", 963 "Ử": "U", 964 "Ữ": "U", 965 "Ự": "U", 966 "Ý": "Y", 967 "à": "a", 968 "á": "a", 969 "â": "a", 970 "ã": "a", 971 "ä": "a", 972 "å": "a", 973 "ấ": "a", 974 "ắ": "a", 975 "ẳ": "a", 976 "ẵ": "a", 977 "ặ": "a", 978 "æ": "ae", 979 "ầ": "a", 980 "ằ": "a", 981 "ȃ": "a", 982 "ả": "a", 983 "ạ": "a", 984 "ẩ": "a", 985 "ẫ": "a", 986 "ậ": "a", 987 "ç": "c", 988 "ḉ": "c", 989 "è": "e", 990 "é": "e", 991 "ê": "e", 992 "ë": "e", 993 "ế": "e", 994 "ḗ": "e", 995 "ề": "e", 996 "ḕ": "e", 997 "ḝ": "e", 998 "ȇ": "e", 999 "ẻ": "e", 1000 "ẽ": "e", 1001 "ẹ": "e", 1002 "ể": "e", 1003 "ễ": "e", 1004 "ệ": "e", 1005 "ì": "i", 1006 "í": "i", 1007 "î": "i", 1008 "ï": "i", 1009 "ḯ": "i", 1010 "ȋ": "i", 1011 "ỉ": "i", 1012 "ị": "i", 1013 "ð": "d", 1014 "ñ": "n", 1015 "ò": "o", 1016 "ó": "o", 1017 "ô": "o", 1018 "õ": "o", 1019 "ö": "o", 1020 "ø": "o", 1021 "ố": "o", 1022 "ṍ": "o", 1023 "ṓ": "o", 1024 "ȏ": "o", 1025 "ỏ": "o", 1026 "ọ": "o", 1027 "ổ": "o", 1028 "ỗ": "o", 1029 "ộ": "o", 1030 "ờ": "o", 1031 "ở": "o", 1032 "ỡ": "o", 1033 "ớ": "o", 1034 "ợ": "o", 1035 "ù": "u", 1036 "ú": "u", 1037 "û": "u", 1038 "ü": "u", 1039 "ủ": "u", 1040 "ụ": "u", 1041 "ử": "u", 1042 "ữ": "u", 1043 "ự": "u", 1044 "ý": "y", 1045 "ÿ": "y", 1046 "Ā": "A", 1047 "ā": "a", 1048 "Ă": "A", 1049 "ă": "a", 1050 "Ą": "A", 1051 "ą": "a", 1052 "Ć": "C", 1053 "ć": "c", 1054 "Ĉ": "C", 1055 "ĉ": "c", 1056 "Ċ": "C", 1057 "ċ": "c", 1058 "Č": "C", 1059 "č": "c", 1060 "C̆": "C", 1061 "c̆": "c", 1062 "Ď": "D", 1063 "ď": "d", 1064 "Đ": "D", 1065 "đ": "d", 1066 "Ē": "E", 1067 "ē": "e", 1068 "Ĕ": "E", 1069 "ĕ": "e", 1070 "Ė": "E", 1071 "ė": "e", 1072 "Ę": "E", 1073 "ę": "e", 1074 "Ě": "E", 1075 "ě": "e", 1076 "Ĝ": "G", 1077 "Ǵ": "G", 1078 "ĝ": "g", 1079 "ǵ": "g", 1080 "Ğ": "G", 1081 "ğ": "g", 1082 "Ġ": "G", 1083 "ġ": "g", 1084 "Ģ": "G", 1085 "ģ": "g", 1086 "Ĥ": "H", 1087 "ĥ": "h", 1088 "Ħ": "H", 1089 "ħ": "h", 1090 "Ḫ": "H", 1091 "ḫ": "h", 1092 "Ĩ": "I", 1093 "ĩ": "i", 1094 "Ī": "I", 1095 "ī": "i", 1096 "Ĭ": "I", 1097 "ĭ": "i", 1098 "Į": "I", 1099 "į": "i", 1100 "İ": "I", 1101 "ı": "i", 1102 "IJ": "IJ", 1103 "ij": "ij", 1104 "Ĵ": "J", 1105 "ĵ": "j", 1106 "Ķ": "K", 1107 "ķ": "k", 1108 "Ḱ": "K", 1109 "ḱ": "k", 1110 "K̆": "K", 1111 "k̆": "k", 1112 "Ĺ": "L", 1113 "ĺ": "l", 1114 "Ļ": "L", 1115 "ļ": "l", 1116 "Ľ": "L", 1117 "ľ": "l", 1118 "Ŀ": "L", 1119 "ŀ": "l", 1120 "Ł": "l", 1121 "ł": "l", 1122 "Ḿ": "M", 1123 "ḿ": "m", 1124 "M̆": "M", 1125 "m̆": "m", 1126 "Ń": "N", 1127 "ń": "n", 1128 "Ņ": "N", 1129 "ņ": "n", 1130 "Ň": "N", 1131 "ň": "n", 1132 "ʼn": "n", 1133 "N̆": "N", 1134 "n̆": "n", 1135 "Ō": "O", 1136 "ō": "o", 1137 "Ŏ": "O", 1138 "ŏ": "o", 1139 "Ő": "O", 1140 "ő": "o", 1141 "Œ": "OE", 1142 "œ": "oe", 1143 "P̆": "P", 1144 "p̆": "p", 1145 "Ŕ": "R", 1146 "ŕ": "r", 1147 "Ŗ": "R", 1148 "ŗ": "r", 1149 "Ř": "R", 1150 "ř": "r", 1151 "R̆": "R", 1152 "r̆": "r", 1153 "Ȓ": "R", 1154 "ȓ": "r", 1155 "Ś": "S", 1156 "ś": "s", 1157 "Ŝ": "S", 1158 "ŝ": "s", 1159 "Ş": "S", 1160 "Ș": "S", 1161 "ș": "s", 1162 "ş": "s", 1163 "Š": "S", 1164 "š": "s", 1165 "Ţ": "T", 1166 "ţ": "t", 1167 "ț": "t", 1168 "Ț": "T", 1169 "Ť": "T", 1170 "ť": "t", 1171 "Ŧ": "T", 1172 "ŧ": "t", 1173 "T̆": "T", 1174 "t̆": "t", 1175 "Ũ": "U", 1176 "ũ": "u", 1177 "Ū": "U", 1178 "ū": "u", 1179 "Ŭ": "U", 1180 "ŭ": "u", 1181 "Ů": "U", 1182 "ů": "u", 1183 "Ű": "U", 1184 "ű": "u", 1185 "Ų": "U", 1186 "ų": "u", 1187 "Ȗ": "U", 1188 "ȗ": "u", 1189 "V̆": "V", 1190 "v̆": "v", 1191 "Ŵ": "W", 1192 "ŵ": "w", 1193 "Ẃ": "W", 1194 "ẃ": "w", 1195 "X̆": "X", 1196 "x̆": "x", 1197 "Ŷ": "Y", 1198 "ŷ": "y", 1199 "Ÿ": "Y", 1200 "Y̆": "Y", 1201 "y̆": "y", 1202 "Ź": "Z", 1203 "ź": "z", 1204 "Ż": "Z", 1205 "ż": "z", 1206 "Ž": "Z", 1207 "ž": "z", 1208 "ſ": "s", 1209 "ƒ": "f", 1210 "Ơ": "O", 1211 "ơ": "o", 1212 "Ư": "U", 1213 "ư": "u", 1214 "Ǎ": "A", 1215 "ǎ": "a", 1216 "Ǐ": "I", 1217 "ǐ": "i", 1218 "Ǒ": "O", 1219 "ǒ": "o", 1220 "Ǔ": "U", 1221 "ǔ": "u", 1222 "Ǖ": "U", 1223 "ǖ": "u", 1224 "Ǘ": "U", 1225 "ǘ": "u", 1226 "Ǚ": "U", 1227 "ǚ": "u", 1228 "Ǜ": "U", 1229 "ǜ": "u", 1230 "Ứ": "U", 1231 "ứ": "u", 1232 "Ṹ": "U", 1233 "ṹ": "u", 1234 "Ǻ": "A", 1235 "ǻ": "a", 1236 "Ǽ": "AE", 1237 "ǽ": "ae", 1238 "Ǿ": "O", 1239 "ǿ": "o", 1240 "Þ": "TH", 1241 "þ": "th", 1242 "Ṕ": "P", 1243 "ṕ": "p", 1244 "Ṥ": "S", 1245 "ṥ": "s", 1246 "X́": "X", 1247 "x́": "x", 1248 "Ѓ": "Г", 1249 "ѓ": "г", 1250 "Ќ": "К", 1251 "ќ": "к", 1252 "A̋": "A", 1253 "a̋": "a", 1254 "E̋": "E", 1255 "e̋": "e", 1256 "I̋": "I", 1257 "i̋": "i", 1258 "Ǹ": "N", 1259 "ǹ": "n", 1260 "Ồ": "O", 1261 "ồ": "o", 1262 "Ṑ": "O", 1263 "ṑ": "o", 1264 "Ừ": "U", 1265 "ừ": "u", 1266 "Ẁ": "W", 1267 "ẁ": "w", 1268 "Ỳ": "Y", 1269 "ỳ": "y", 1270 "Ȁ": "A", 1271 "ȁ": "a", 1272 "Ȅ": "E", 1273 "ȅ": "e", 1274 "Ȉ": "I", 1275 "ȉ": "i", 1276 "Ȍ": "O", 1277 "ȍ": "o", 1278 "Ȑ": "R", 1279 "ȑ": "r", 1280 "Ȕ": "U", 1281 "ȕ": "u", 1282 "B̌": "B", 1283 "b̌": "b", 1284 "Č̣": "C", 1285 "č̣": "c", 1286 "Ê̌": "E", 1287 "ê̌": "e", 1288 "F̌": "F", 1289 "f̌": "f", 1290 "Ǧ": "G", 1291 "ǧ": "g", 1292 "Ȟ": "H", 1293 "ȟ": "h", 1294 "J̌": "J", 1295 "ǰ": "j", 1296 "Ǩ": "K", 1297 "ǩ": "k", 1298 "M̌": "M", 1299 "m̌": "m", 1300 "P̌": "P", 1301 "p̌": "p", 1302 "Q̌": "Q", 1303 "q̌": "q", 1304 "Ř̩": "R", 1305 "ř̩": "r", 1306 "Ṧ": "S", 1307 "ṧ": "s", 1308 "V̌": "V", 1309 "v̌": "v", 1310 "W̌": "W", 1311 "w̌": "w", 1312 "X̌": "X", 1313 "x̌": "x", 1314 "Y̌": "Y", 1315 "y̌": "y", 1316 "A̧": "A", 1317 "a̧": "a", 1318 "B̧": "B", 1319 "b̧": "b", 1320 "Ḑ": "D", 1321 "ḑ": "d", 1322 "Ȩ": "E", 1323 "ȩ": "e", 1324 "Ɛ̧": "E", 1325 "ɛ̧": "e", 1326 "Ḩ": "H", 1327 "ḩ": "h", 1328 "I̧": "I", 1329 "i̧": "i", 1330 "Ɨ̧": "I", 1331 "ɨ̧": "i", 1332 "M̧": "M", 1333 "m̧": "m", 1334 "O̧": "O", 1335 "o̧": "o", 1336 "Q̧": "Q", 1337 "q̧": "q", 1338 "U̧": "U", 1339 "u̧": "u", 1340 "X̧": "X", 1341 "x̧": "x", 1342 "Z̧": "Z", 1343 "z̧": "z", 1344 "й":"и", 1345 "Й":"И", 1346 "ё":"е", 1347 "Ё":"Е", 1348 }; 1349 1350 var chars = Object.keys(characterMap).join('|'); 1351 var allAccents = new RegExp(chars, 'g'); 1352 var firstAccent = new RegExp(chars, ''); 1353 1354 function matcher(match) { 1355 return characterMap[match]; 1356 } 1357 1358 var removeAccents = function(string) { 1359 return string.replace(allAccents, matcher); 1360 }; 1361 1362 var hasAccents = function(string) { 1363 return !!string.match(firstAccent); 1364 }; 1365 1366 module.exports = removeAccents; 1367 module.exports.has = hasAccents; 1368 module.exports.remove = removeAccents; 1369 1370 1371 /***/ }), 1372 1373 /***/ 1609: 1374 /***/ ((module) => { 1375 1376 "use strict"; 1377 module.exports = window["React"]; 1378 1379 /***/ }) 1380 1381 /******/ }); 1382 /************************************************************************/ 1383 /******/ // The module cache 1384 /******/ var __webpack_module_cache__ = {}; 1385 /******/ 1386 /******/ // The require function 1387 /******/ function __webpack_require__(moduleId) { 1388 /******/ // Check if module is in cache 1389 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 1390 /******/ if (cachedModule !== undefined) { 1391 /******/ return cachedModule.exports; 1392 /******/ } 1393 /******/ // Create a new module (and put it into the cache) 1394 /******/ var module = __webpack_module_cache__[moduleId] = { 1395 /******/ // no module.id needed 1396 /******/ // no module.loaded needed 1397 /******/ exports: {} 1398 /******/ }; 1399 /******/ 1400 /******/ // Execute the module function 1401 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 1402 /******/ 1403 /******/ // Return the exports of the module 1404 /******/ return module.exports; 1405 /******/ } 1406 /******/ 1407 /************************************************************************/ 1408 /******/ /* webpack/runtime/compat get default export */ 1409 /******/ (() => { 1410 /******/ // getDefaultExport function for compatibility with non-harmony modules 1411 /******/ __webpack_require__.n = (module) => { 1412 /******/ var getter = module && module.__esModule ? 1413 /******/ () => (module['default']) : 1414 /******/ () => (module); 1415 /******/ __webpack_require__.d(getter, { a: getter }); 1416 /******/ return getter; 1417 /******/ }; 1418 /******/ })(); 1419 /******/ 1420 /******/ /* webpack/runtime/define property getters */ 1421 /******/ (() => { 1422 /******/ // define getter functions for harmony exports 1423 /******/ __webpack_require__.d = (exports, definition) => { 1424 /******/ for(var key in definition) { 1425 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 1426 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 1427 /******/ } 1428 /******/ } 1429 /******/ }; 1430 /******/ })(); 1431 /******/ 1432 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 1433 /******/ (() => { 1434 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 1435 /******/ })(); 1436 /******/ 1437 /******/ /* webpack/runtime/make namespace object */ 1438 /******/ (() => { 1439 /******/ // define __esModule on exports 1440 /******/ __webpack_require__.r = (exports) => { 1441 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 1442 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 1443 /******/ } 1444 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 1445 /******/ }; 1446 /******/ })(); 1447 /******/ 1448 /************************************************************************/ 1449 var __webpack_exports__ = {}; 1450 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 1451 (() => { 1452 "use strict"; 1453 // ESM COMPAT FLAG 1454 __webpack_require__.r(__webpack_exports__); 1455 1456 // EXPORTS 1457 __webpack_require__.d(__webpack_exports__, { 1458 AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), 1459 Autocomplete: () => (/* reexport */ Autocomplete), 1460 AutosaveMonitor: () => (/* reexport */ autosave_monitor), 1461 BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), 1462 BlockControls: () => (/* reexport */ BlockControls), 1463 BlockEdit: () => (/* reexport */ BlockEdit), 1464 BlockEditorKeyboardShortcuts: () => (/* reexport */ BlockEditorKeyboardShortcuts), 1465 BlockFormatControls: () => (/* reexport */ BlockFormatControls), 1466 BlockIcon: () => (/* reexport */ BlockIcon), 1467 BlockInspector: () => (/* reexport */ BlockInspector), 1468 BlockList: () => (/* reexport */ BlockList), 1469 BlockMover: () => (/* reexport */ BlockMover), 1470 BlockNavigationDropdown: () => (/* reexport */ BlockNavigationDropdown), 1471 BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), 1472 BlockSettingsMenu: () => (/* reexport */ BlockSettingsMenu), 1473 BlockTitle: () => (/* reexport */ BlockTitle), 1474 BlockToolbar: () => (/* reexport */ BlockToolbar), 1475 CharacterCount: () => (/* reexport */ CharacterCount), 1476 ColorPalette: () => (/* reexport */ ColorPalette), 1477 ContrastChecker: () => (/* reexport */ ContrastChecker), 1478 CopyHandler: () => (/* reexport */ CopyHandler), 1479 DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), 1480 DocumentBar: () => (/* reexport */ DocumentBar), 1481 DocumentOutline: () => (/* reexport */ DocumentOutline), 1482 DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck), 1483 EditorHistoryRedo: () => (/* reexport */ editor_history_redo), 1484 EditorHistoryUndo: () => (/* reexport */ editor_history_undo), 1485 EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts), 1486 EditorKeyboardShortcutsRegister: () => (/* reexport */ register_shortcuts), 1487 EditorNotices: () => (/* reexport */ editor_notices), 1488 EditorProvider: () => (/* reexport */ provider), 1489 EditorSnackbars: () => (/* reexport */ EditorSnackbars), 1490 EntitiesSavedStates: () => (/* reexport */ EntitiesSavedStates), 1491 ErrorBoundary: () => (/* reexport */ error_boundary), 1492 FontSizePicker: () => (/* reexport */ FontSizePicker), 1493 InnerBlocks: () => (/* reexport */ InnerBlocks), 1494 Inserter: () => (/* reexport */ Inserter), 1495 InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), 1496 InspectorControls: () => (/* reexport */ InspectorControls), 1497 LocalAutosaveMonitor: () => (/* reexport */ local_autosave_monitor), 1498 MediaPlaceholder: () => (/* reexport */ MediaPlaceholder), 1499 MediaUpload: () => (/* reexport */ MediaUpload), 1500 MediaUploadCheck: () => (/* reexport */ MediaUploadCheck), 1501 MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), 1502 NavigableToolbar: () => (/* reexport */ NavigableToolbar), 1503 ObserveTyping: () => (/* reexport */ ObserveTyping), 1504 PageAttributesCheck: () => (/* reexport */ page_attributes_check), 1505 PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks), 1506 PageAttributesPanel: () => (/* reexport */ PageAttributesPanel), 1507 PageAttributesParent: () => (/* reexport */ page_attributes_parent), 1508 PageTemplate: () => (/* reexport */ classic_theme), 1509 PanelColorSettings: () => (/* reexport */ PanelColorSettings), 1510 PlainText: () => (/* reexport */ PlainText), 1511 PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item), 1512 PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel), 1513 PluginMoreMenuItem: () => (/* reexport */ plugin_more_menu_item), 1514 PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel), 1515 PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info), 1516 PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel), 1517 PluginSidebar: () => (/* reexport */ PluginSidebar), 1518 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 1519 PostAuthor: () => (/* reexport */ post_author), 1520 PostAuthorCheck: () => (/* reexport */ PostAuthorCheck), 1521 PostAuthorPanel: () => (/* reexport */ panel), 1522 PostComments: () => (/* reexport */ post_comments), 1523 PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel), 1524 PostExcerpt: () => (/* reexport */ PostExcerpt), 1525 PostExcerptCheck: () => (/* reexport */ post_excerpt_check), 1526 PostExcerptPanel: () => (/* reexport */ PostExcerptPanel), 1527 PostFeaturedImage: () => (/* reexport */ post_featured_image), 1528 PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check), 1529 PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel), 1530 PostFormat: () => (/* reexport */ PostFormat), 1531 PostFormatCheck: () => (/* reexport */ post_format_check), 1532 PostLastRevision: () => (/* reexport */ post_last_revision), 1533 PostLastRevisionCheck: () => (/* reexport */ post_last_revision_check), 1534 PostLastRevisionPanel: () => (/* reexport */ post_last_revision_panel), 1535 PostLockedModal: () => (/* reexport */ PostLockedModal), 1536 PostPendingStatus: () => (/* reexport */ post_pending_status), 1537 PostPendingStatusCheck: () => (/* reexport */ post_pending_status_check), 1538 PostPingbacks: () => (/* reexport */ post_pingbacks), 1539 PostPreviewButton: () => (/* reexport */ PostPreviewButton), 1540 PostPublishButton: () => (/* reexport */ post_publish_button), 1541 PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel), 1542 PostPublishPanel: () => (/* reexport */ post_publish_panel), 1543 PostSavedState: () => (/* reexport */ PostSavedState), 1544 PostSchedule: () => (/* reexport */ PostSchedule), 1545 PostScheduleCheck: () => (/* reexport */ PostScheduleCheck), 1546 PostScheduleLabel: () => (/* reexport */ PostScheduleLabel), 1547 PostSchedulePanel: () => (/* reexport */ PostSchedulePanel), 1548 PostSlug: () => (/* reexport */ PostSlug), 1549 PostSlugCheck: () => (/* reexport */ PostSlugCheck), 1550 PostSticky: () => (/* reexport */ PostSticky), 1551 PostStickyCheck: () => (/* reexport */ PostStickyCheck), 1552 PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton), 1553 PostSyncStatus: () => (/* reexport */ PostSyncStatus), 1554 PostTaxonomies: () => (/* reexport */ post_taxonomies), 1555 PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck), 1556 PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector), 1557 PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector), 1558 PostTaxonomiesPanel: () => (/* reexport */ post_taxonomies_panel), 1559 PostTemplatePanel: () => (/* reexport */ PostTemplatePanel), 1560 PostTextEditor: () => (/* reexport */ PostTextEditor), 1561 PostTitle: () => (/* reexport */ post_title), 1562 PostTitleRaw: () => (/* reexport */ post_title_raw), 1563 PostTrash: () => (/* reexport */ PostTrash), 1564 PostTrashCheck: () => (/* reexport */ PostTrashCheck), 1565 PostTypeSupportCheck: () => (/* reexport */ post_type_support_check), 1566 PostURL: () => (/* reexport */ PostURL), 1567 PostURLCheck: () => (/* reexport */ PostURLCheck), 1568 PostURLLabel: () => (/* reexport */ PostURLLabel), 1569 PostURLPanel: () => (/* reexport */ PostURLPanel), 1570 PostVisibility: () => (/* reexport */ PostVisibility), 1571 PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck), 1572 PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel), 1573 RichText: () => (/* reexport */ RichText), 1574 RichTextShortcut: () => (/* reexport */ RichTextShortcut), 1575 RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), 1576 ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())), 1577 SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), 1578 TableOfContents: () => (/* reexport */ table_of_contents), 1579 TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts), 1580 ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck), 1581 TimeToRead: () => (/* reexport */ TimeToRead), 1582 URLInput: () => (/* reexport */ URLInput), 1583 URLInputButton: () => (/* reexport */ URLInputButton), 1584 URLPopover: () => (/* reexport */ URLPopover), 1585 UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning), 1586 VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts), 1587 Warning: () => (/* reexport */ Warning), 1588 WordCount: () => (/* reexport */ WordCount), 1589 WritingFlow: () => (/* reexport */ WritingFlow), 1590 __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), 1591 cleanForSlug: () => (/* reexport */ cleanForSlug), 1592 createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), 1593 getColorClassName: () => (/* reexport */ getColorClassName), 1594 getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), 1595 getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), 1596 getFontSize: () => (/* reexport */ getFontSize), 1597 getFontSizeClass: () => (/* reexport */ getFontSizeClass), 1598 getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon), 1599 mediaUpload: () => (/* reexport */ mediaUpload), 1600 privateApis: () => (/* reexport */ privateApis), 1601 store: () => (/* reexport */ store_store), 1602 storeConfig: () => (/* reexport */ storeConfig), 1603 transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles), 1604 useEntitiesSavedStatesIsDirty: () => (/* reexport */ useIsDirty), 1605 usePostScheduleLabel: () => (/* reexport */ usePostScheduleLabel), 1606 usePostURLLabel: () => (/* reexport */ usePostURLLabel), 1607 usePostVisibilityLabel: () => (/* reexport */ usePostVisibilityLabel), 1608 userAutocompleter: () => (/* reexport */ user), 1609 withColorContext: () => (/* reexport */ withColorContext), 1610 withColors: () => (/* reexport */ withColors), 1611 withFontSizes: () => (/* reexport */ withFontSizes) 1612 }); 1613 1614 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js 1615 var selectors_namespaceObject = {}; 1616 __webpack_require__.r(selectors_namespaceObject); 1617 __webpack_require__.d(selectors_namespaceObject, { 1618 __experimentalGetDefaultTemplatePartAreas: () => (__experimentalGetDefaultTemplatePartAreas), 1619 __experimentalGetDefaultTemplateType: () => (__experimentalGetDefaultTemplateType), 1620 __experimentalGetDefaultTemplateTypes: () => (__experimentalGetDefaultTemplateTypes), 1621 __experimentalGetTemplateInfo: () => (__experimentalGetTemplateInfo), 1622 __unstableIsEditorReady: () => (__unstableIsEditorReady), 1623 canInsertBlockType: () => (canInsertBlockType), 1624 canUserUseUnfilteredHTML: () => (canUserUseUnfilteredHTML), 1625 didPostSaveRequestFail: () => (didPostSaveRequestFail), 1626 didPostSaveRequestSucceed: () => (didPostSaveRequestSucceed), 1627 getActivePostLock: () => (getActivePostLock), 1628 getAdjacentBlockClientId: () => (getAdjacentBlockClientId), 1629 getAutosaveAttribute: () => (getAutosaveAttribute), 1630 getBlock: () => (getBlock), 1631 getBlockAttributes: () => (getBlockAttributes), 1632 getBlockCount: () => (getBlockCount), 1633 getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), 1634 getBlockIndex: () => (getBlockIndex), 1635 getBlockInsertionPoint: () => (getBlockInsertionPoint), 1636 getBlockListSettings: () => (getBlockListSettings), 1637 getBlockMode: () => (getBlockMode), 1638 getBlockName: () => (getBlockName), 1639 getBlockOrder: () => (getBlockOrder), 1640 getBlockRootClientId: () => (getBlockRootClientId), 1641 getBlockSelectionEnd: () => (getBlockSelectionEnd), 1642 getBlockSelectionStart: () => (getBlockSelectionStart), 1643 getBlocks: () => (getBlocks), 1644 getBlocksByClientId: () => (getBlocksByClientId), 1645 getClientIdsOfDescendants: () => (getClientIdsOfDescendants), 1646 getClientIdsWithDescendants: () => (getClientIdsWithDescendants), 1647 getCurrentPost: () => (getCurrentPost), 1648 getCurrentPostAttribute: () => (getCurrentPostAttribute), 1649 getCurrentPostId: () => (getCurrentPostId), 1650 getCurrentPostLastRevisionId: () => (getCurrentPostLastRevisionId), 1651 getCurrentPostRevisionsCount: () => (getCurrentPostRevisionsCount), 1652 getCurrentPostType: () => (getCurrentPostType), 1653 getCurrentTemplateId: () => (getCurrentTemplateId), 1654 getDeviceType: () => (getDeviceType), 1655 getEditedPostAttribute: () => (getEditedPostAttribute), 1656 getEditedPostContent: () => (getEditedPostContent), 1657 getEditedPostPreviewLink: () => (getEditedPostPreviewLink), 1658 getEditedPostSlug: () => (getEditedPostSlug), 1659 getEditedPostVisibility: () => (getEditedPostVisibility), 1660 getEditorBlocks: () => (getEditorBlocks), 1661 getEditorMode: () => (getEditorMode), 1662 getEditorSelection: () => (getEditorSelection), 1663 getEditorSelectionEnd: () => (getEditorSelectionEnd), 1664 getEditorSelectionStart: () => (getEditorSelectionStart), 1665 getEditorSettings: () => (getEditorSettings), 1666 getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), 1667 getGlobalBlockCount: () => (getGlobalBlockCount), 1668 getInserterItems: () => (getInserterItems), 1669 getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), 1670 getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), 1671 getMultiSelectedBlocks: () => (getMultiSelectedBlocks), 1672 getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), 1673 getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), 1674 getNextBlockClientId: () => (getNextBlockClientId), 1675 getPermalink: () => (getPermalink), 1676 getPermalinkParts: () => (getPermalinkParts), 1677 getPostEdits: () => (getPostEdits), 1678 getPostLockUser: () => (getPostLockUser), 1679 getPostTypeLabel: () => (getPostTypeLabel), 1680 getPreviousBlockClientId: () => (getPreviousBlockClientId), 1681 getRenderingMode: () => (getRenderingMode), 1682 getSelectedBlock: () => (getSelectedBlock), 1683 getSelectedBlockClientId: () => (getSelectedBlockClientId), 1684 getSelectedBlockCount: () => (getSelectedBlockCount), 1685 getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), 1686 getStateBeforeOptimisticTransaction: () => (getStateBeforeOptimisticTransaction), 1687 getSuggestedPostFormat: () => (getSuggestedPostFormat), 1688 getTemplate: () => (getTemplate), 1689 getTemplateLock: () => (getTemplateLock), 1690 hasChangedContent: () => (hasChangedContent), 1691 hasEditorRedo: () => (hasEditorRedo), 1692 hasEditorUndo: () => (hasEditorUndo), 1693 hasInserterItems: () => (hasInserterItems), 1694 hasMultiSelection: () => (hasMultiSelection), 1695 hasNonPostEntityChanges: () => (hasNonPostEntityChanges), 1696 hasSelectedBlock: () => (hasSelectedBlock), 1697 hasSelectedInnerBlock: () => (hasSelectedInnerBlock), 1698 inSomeHistory: () => (inSomeHistory), 1699 isAncestorMultiSelected: () => (isAncestorMultiSelected), 1700 isAutosavingPost: () => (isAutosavingPost), 1701 isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), 1702 isBlockMultiSelected: () => (isBlockMultiSelected), 1703 isBlockSelected: () => (isBlockSelected), 1704 isBlockValid: () => (isBlockValid), 1705 isBlockWithinSelection: () => (isBlockWithinSelection), 1706 isCaretWithinFormattedText: () => (isCaretWithinFormattedText), 1707 isCleanNewPost: () => (isCleanNewPost), 1708 isCurrentPostPending: () => (isCurrentPostPending), 1709 isCurrentPostPublished: () => (isCurrentPostPublished), 1710 isCurrentPostScheduled: () => (isCurrentPostScheduled), 1711 isDeletingPost: () => (isDeletingPost), 1712 isEditedPostAutosaveable: () => (isEditedPostAutosaveable), 1713 isEditedPostBeingScheduled: () => (isEditedPostBeingScheduled), 1714 isEditedPostDateFloating: () => (isEditedPostDateFloating), 1715 isEditedPostDirty: () => (isEditedPostDirty), 1716 isEditedPostEmpty: () => (isEditedPostEmpty), 1717 isEditedPostNew: () => (isEditedPostNew), 1718 isEditedPostPublishable: () => (isEditedPostPublishable), 1719 isEditedPostSaveable: () => (isEditedPostSaveable), 1720 isEditorPanelEnabled: () => (isEditorPanelEnabled), 1721 isEditorPanelOpened: () => (isEditorPanelOpened), 1722 isEditorPanelRemoved: () => (isEditorPanelRemoved), 1723 isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), 1724 isInserterOpened: () => (isInserterOpened), 1725 isListViewOpened: () => (isListViewOpened), 1726 isMultiSelecting: () => (isMultiSelecting), 1727 isPermalinkEditable: () => (isPermalinkEditable), 1728 isPostAutosavingLocked: () => (isPostAutosavingLocked), 1729 isPostLockTakeover: () => (isPostLockTakeover), 1730 isPostLocked: () => (isPostLocked), 1731 isPostSavingLocked: () => (isPostSavingLocked), 1732 isPreviewingPost: () => (isPreviewingPost), 1733 isPublishSidebarEnabled: () => (isPublishSidebarEnabled), 1734 isPublishSidebarOpened: () => (isPublishSidebarOpened), 1735 isPublishingPost: () => (isPublishingPost), 1736 isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges), 1737 isSavingPost: () => (isSavingPost), 1738 isSelectionEnabled: () => (isSelectionEnabled), 1739 isTyping: () => (isTyping), 1740 isValidTemplate: () => (isValidTemplate) 1741 }); 1742 1743 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js 1744 var actions_namespaceObject = {}; 1745 __webpack_require__.r(actions_namespaceObject); 1746 __webpack_require__.d(actions_namespaceObject, { 1747 __experimentalTearDownEditor: () => (__experimentalTearDownEditor), 1748 __unstableSaveForPreview: () => (__unstableSaveForPreview), 1749 autosave: () => (autosave), 1750 clearSelectedBlock: () => (clearSelectedBlock), 1751 closePublishSidebar: () => (closePublishSidebar), 1752 createUndoLevel: () => (createUndoLevel), 1753 disablePublishSidebar: () => (disablePublishSidebar), 1754 editPost: () => (editPost), 1755 enablePublishSidebar: () => (enablePublishSidebar), 1756 enterFormattedText: () => (enterFormattedText), 1757 exitFormattedText: () => (exitFormattedText), 1758 hideInsertionPoint: () => (hideInsertionPoint), 1759 insertBlock: () => (insertBlock), 1760 insertBlocks: () => (insertBlocks), 1761 insertDefaultBlock: () => (insertDefaultBlock), 1762 lockPostAutosaving: () => (lockPostAutosaving), 1763 lockPostSaving: () => (lockPostSaving), 1764 mergeBlocks: () => (mergeBlocks), 1765 moveBlockToPosition: () => (moveBlockToPosition), 1766 moveBlocksDown: () => (moveBlocksDown), 1767 moveBlocksUp: () => (moveBlocksUp), 1768 multiSelect: () => (multiSelect), 1769 openPublishSidebar: () => (openPublishSidebar), 1770 receiveBlocks: () => (receiveBlocks), 1771 redo: () => (redo), 1772 refreshPost: () => (refreshPost), 1773 removeBlock: () => (removeBlock), 1774 removeBlocks: () => (removeBlocks), 1775 removeEditorPanel: () => (removeEditorPanel), 1776 replaceBlock: () => (replaceBlock), 1777 replaceBlocks: () => (replaceBlocks), 1778 resetBlocks: () => (resetBlocks), 1779 resetEditorBlocks: () => (resetEditorBlocks), 1780 resetPost: () => (resetPost), 1781 savePost: () => (savePost), 1782 selectBlock: () => (selectBlock), 1783 setDeviceType: () => (setDeviceType), 1784 setEditedPost: () => (setEditedPost), 1785 setIsInserterOpened: () => (setIsInserterOpened), 1786 setIsListViewOpened: () => (setIsListViewOpened), 1787 setRenderingMode: () => (setRenderingMode), 1788 setTemplateValidity: () => (setTemplateValidity), 1789 setupEditor: () => (setupEditor), 1790 setupEditorState: () => (setupEditorState), 1791 showInsertionPoint: () => (showInsertionPoint), 1792 startMultiSelect: () => (startMultiSelect), 1793 startTyping: () => (startTyping), 1794 stopMultiSelect: () => (stopMultiSelect), 1795 stopTyping: () => (stopTyping), 1796 switchEditorMode: () => (switchEditorMode), 1797 synchronizeTemplate: () => (synchronizeTemplate), 1798 toggleBlockMode: () => (toggleBlockMode), 1799 toggleDistractionFree: () => (toggleDistractionFree), 1800 toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), 1801 toggleEditorPanelOpened: () => (toggleEditorPanelOpened), 1802 togglePublishSidebar: () => (togglePublishSidebar), 1803 toggleSelection: () => (toggleSelection), 1804 trashPost: () => (trashPost), 1805 undo: () => (undo), 1806 unlockPostAutosaving: () => (unlockPostAutosaving), 1807 unlockPostSaving: () => (unlockPostSaving), 1808 updateBlock: () => (updateBlock), 1809 updateBlockAttributes: () => (updateBlockAttributes), 1810 updateBlockListSettings: () => (updateBlockListSettings), 1811 updateEditorSettings: () => (updateEditorSettings), 1812 updatePost: () => (updatePost), 1813 updatePostLock: () => (updatePostLock) 1814 }); 1815 1816 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js 1817 var private_actions_namespaceObject = {}; 1818 __webpack_require__.r(private_actions_namespaceObject); 1819 __webpack_require__.d(private_actions_namespaceObject, { 1820 createTemplate: () => (createTemplate), 1821 hideBlockTypes: () => (hideBlockTypes), 1822 removeTemplates: () => (removeTemplates), 1823 revertTemplate: () => (revertTemplate), 1824 saveDirtyEntities: () => (saveDirtyEntities), 1825 setCurrentTemplateId: () => (setCurrentTemplateId), 1826 showBlockTypes: () => (showBlockTypes) 1827 }); 1828 1829 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 1830 var private_selectors_namespaceObject = {}; 1831 __webpack_require__.r(private_selectors_namespaceObject); 1832 __webpack_require__.d(private_selectors_namespaceObject, { 1833 getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), 1834 getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), 1835 getInsertionPoint: () => (getInsertionPoint), 1836 getListViewToggleRef: () => (getListViewToggleRef), 1837 getPostIcon: () => (getPostIcon), 1838 hasPostMetaChanges: () => (hasPostMetaChanges) 1839 }); 1840 1841 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 1842 var store_actions_namespaceObject = {}; 1843 __webpack_require__.r(store_actions_namespaceObject); 1844 __webpack_require__.d(store_actions_namespaceObject, { 1845 closeModal: () => (closeModal), 1846 disableComplementaryArea: () => (disableComplementaryArea), 1847 enableComplementaryArea: () => (enableComplementaryArea), 1848 openModal: () => (openModal), 1849 pinItem: () => (pinItem), 1850 setDefaultComplementaryArea: () => (setDefaultComplementaryArea), 1851 setFeatureDefaults: () => (setFeatureDefaults), 1852 setFeatureValue: () => (setFeatureValue), 1853 toggleFeature: () => (toggleFeature), 1854 unpinItem: () => (unpinItem) 1855 }); 1856 1857 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 1858 var store_selectors_namespaceObject = {}; 1859 __webpack_require__.r(store_selectors_namespaceObject); 1860 __webpack_require__.d(store_selectors_namespaceObject, { 1861 getActiveComplementaryArea: () => (getActiveComplementaryArea), 1862 isComplementaryAreaLoading: () => (isComplementaryAreaLoading), 1863 isFeatureActive: () => (isFeatureActive), 1864 isItemPinned: () => (isItemPinned), 1865 isModalActive: () => (isModalActive) 1866 }); 1867 1868 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js 1869 var build_module_namespaceObject = {}; 1870 __webpack_require__.r(build_module_namespaceObject); 1871 __webpack_require__.d(build_module_namespaceObject, { 1872 ActionItem: () => (action_item), 1873 ComplementaryArea: () => (complementary_area), 1874 ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem), 1875 FullscreenMode: () => (fullscreen_mode), 1876 InterfaceSkeleton: () => (interface_skeleton), 1877 NavigableRegion: () => (NavigableRegion), 1878 PinnedItems: () => (pinned_items), 1879 store: () => (store) 1880 }); 1881 1882 ;// CONCATENATED MODULE: external ["wp","blocks"] 1883 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 1884 ;// CONCATENATED MODULE: external ["wp","data"] 1885 const external_wp_data_namespaceObject = window["wp"]["data"]; 1886 ;// CONCATENATED MODULE: external ["wp","privateApis"] 1887 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 1888 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/lock-unlock.js 1889 /** 1890 * WordPress dependencies 1891 */ 1892 1893 const { 1894 lock, 1895 unlock 1896 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/editor'); 1897 1898 ;// CONCATENATED MODULE: external ["wp","i18n"] 1899 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 1900 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 1901 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 1902 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js 1903 /** 1904 * WordPress dependencies 1905 */ 1906 1907 1908 const CONTENT = 'content'; 1909 /* harmony default export */ const pattern_overrides = ({ 1910 name: 'core/pattern-overrides', 1911 label: (0,external_wp_i18n_namespaceObject._x)('Pattern Overrides', 'block bindings source'), 1912 getValue({ 1913 registry, 1914 clientId, 1915 context, 1916 attributeName 1917 }) { 1918 const patternOverridesContent = context['pattern/overrides']; 1919 const { 1920 getBlockAttributes 1921 } = registry.select(external_wp_blockEditor_namespaceObject.store); 1922 const currentBlockAttributes = getBlockAttributes(clientId); 1923 if (!patternOverridesContent) { 1924 return currentBlockAttributes[attributeName]; 1925 } 1926 const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName]; 1927 1928 // If there is no pattern client ID, or it is not overwritten, return the default value. 1929 if (overridableValue === undefined) { 1930 return currentBlockAttributes[attributeName]; 1931 } 1932 return overridableValue === '' ? undefined : overridableValue; 1933 }, 1934 setValues({ 1935 registry, 1936 clientId, 1937 attributes 1938 }) { 1939 const { 1940 getBlockAttributes, 1941 getBlockParentsByBlockName, 1942 getBlocks 1943 } = registry.select(external_wp_blockEditor_namespaceObject.store); 1944 const currentBlockAttributes = getBlockAttributes(clientId); 1945 const blockName = currentBlockAttributes?.metadata?.name; 1946 if (!blockName) { 1947 return; 1948 } 1949 const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true); 1950 1951 // If there is no pattern client ID, sync blocks with the same name and same attributes. 1952 if (!patternClientId) { 1953 const syncBlocksWithSameName = blocks => { 1954 for (const block of blocks) { 1955 if (block.attributes?.metadata?.name === blockName) { 1956 registry.dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(block.clientId, attributes); 1957 } 1958 syncBlocksWithSameName(block.innerBlocks); 1959 } 1960 }; 1961 syncBlocksWithSameName(getBlocks()); 1962 return; 1963 } 1964 const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT]; 1965 registry.dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, { 1966 [CONTENT]: { 1967 ...currentBindingValue, 1968 [blockName]: { 1969 ...currentBindingValue?.[blockName], 1970 ...Object.entries(attributes).reduce((acc, [key, value]) => { 1971 // TODO: We need a way to represent `undefined` in the serialized overrides. 1972 // Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871 1973 // We use an empty string to represent undefined for now until 1974 // we support a richer format for overrides and the block bindings API. 1975 acc[key] = value === undefined ? '' : value; 1976 return acc; 1977 }, {}) 1978 } 1979 } 1980 }); 1981 }, 1982 canUserEditValue: () => true 1983 }); 1984 1985 ;// CONCATENATED MODULE: external ["wp","coreData"] 1986 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 1987 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js 1988 /** 1989 * WordPress dependencies 1990 */ 1991 1992 1993 /** 1994 * The default post editor settings. 1995 * 1996 * @property {boolean|Array} allowedBlockTypes Allowed block types 1997 * @property {boolean} richEditingEnabled Whether rich editing is enabled or not 1998 * @property {boolean} codeEditingEnabled Whether code editing is enabled or not 1999 * @property {boolean} fontLibraryEnabled Whether the font library is enabled or not. 2000 * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not. 2001 * true = the user has opted to show the Custom Fields panel at the bottom of the editor. 2002 * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. 2003 * 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. 2004 * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API. 2005 * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage. 2006 * @property {Array?} availableTemplates The available post templates 2007 * @property {boolean} disablePostFormats Whether or not the post formats are disabled 2008 * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions 2009 * @property {number} maxUploadFileSize Maximum upload file size 2010 * @property {boolean} supportsLayout Whether the editor supports layouts. 2011 */ 2012 const EDITOR_SETTINGS_DEFAULTS = { 2013 ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, 2014 richEditingEnabled: true, 2015 codeEditingEnabled: true, 2016 fontLibraryEnabled: true, 2017 enableCustomFields: undefined, 2018 defaultRenderingMode: 'post-only' 2019 }; 2020 2021 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js 2022 /** 2023 * WordPress dependencies 2024 */ 2025 2026 2027 /** 2028 * Internal dependencies 2029 */ 2030 2031 2032 /** 2033 * Returns a post attribute value, flattening nested rendered content using its 2034 * raw value in place of its original object form. 2035 * 2036 * @param {*} value Original value. 2037 * 2038 * @return {*} Raw value. 2039 */ 2040 function getPostRawValue(value) { 2041 if (value && 'object' === typeof value && 'raw' in value) { 2042 return value.raw; 2043 } 2044 return value; 2045 } 2046 2047 /** 2048 * Returns true if the two object arguments have the same keys, or false 2049 * otherwise. 2050 * 2051 * @param {Object} a First object. 2052 * @param {Object} b Second object. 2053 * 2054 * @return {boolean} Whether the two objects have the same keys. 2055 */ 2056 function hasSameKeys(a, b) { 2057 const keysA = Object.keys(a).sort(); 2058 const keysB = Object.keys(b).sort(); 2059 return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key); 2060 } 2061 2062 /** 2063 * Returns true if, given the currently dispatching action and the previously 2064 * dispatched action, the two actions are editing the same post property, or 2065 * false otherwise. 2066 * 2067 * @param {Object} action Currently dispatching action. 2068 * @param {Object} previousAction Previously dispatched action. 2069 * 2070 * @return {boolean} Whether actions are updating the same post property. 2071 */ 2072 function isUpdatingSamePostProperty(action, previousAction) { 2073 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); 2074 } 2075 2076 /** 2077 * Returns true if, given the currently dispatching action and the previously 2078 * dispatched action, the two actions are modifying the same property such that 2079 * undo history should be batched. 2080 * 2081 * @param {Object} action Currently dispatching action. 2082 * @param {Object} previousAction Previously dispatched action. 2083 * 2084 * @return {boolean} Whether to overwrite present state. 2085 */ 2086 function shouldOverwriteState(action, previousAction) { 2087 if (action.type === 'RESET_EDITOR_BLOCKS') { 2088 return !action.shouldCreateUndoLevel; 2089 } 2090 if (!previousAction || action.type !== previousAction.type) { 2091 return false; 2092 } 2093 return isUpdatingSamePostProperty(action, previousAction); 2094 } 2095 function postId(state = null, action) { 2096 switch (action.type) { 2097 case 'SET_EDITED_POST': 2098 return action.postId; 2099 } 2100 return state; 2101 } 2102 function templateId(state = null, action) { 2103 switch (action.type) { 2104 case 'SET_CURRENT_TEMPLATE_ID': 2105 return action.id; 2106 } 2107 return state; 2108 } 2109 function postType(state = null, action) { 2110 switch (action.type) { 2111 case 'SET_EDITED_POST': 2112 return action.postType; 2113 } 2114 return state; 2115 } 2116 2117 /** 2118 * Reducer returning whether the post blocks match the defined template or not. 2119 * 2120 * @param {Object} state Current state. 2121 * @param {Object} action Dispatched action. 2122 * 2123 * @return {boolean} Updated state. 2124 */ 2125 function template(state = { 2126 isValid: true 2127 }, action) { 2128 switch (action.type) { 2129 case 'SET_TEMPLATE_VALIDITY': 2130 return { 2131 ...state, 2132 isValid: action.isValid 2133 }; 2134 } 2135 return state; 2136 } 2137 2138 /** 2139 * Reducer returning current network request state (whether a request to 2140 * the WP REST API is in progress, successful, or failed). 2141 * 2142 * @param {Object} state Current state. 2143 * @param {Object} action Dispatched action. 2144 * 2145 * @return {Object} Updated state. 2146 */ 2147 function saving(state = {}, action) { 2148 switch (action.type) { 2149 case 'REQUEST_POST_UPDATE_START': 2150 case 'REQUEST_POST_UPDATE_FINISH': 2151 return { 2152 pending: action.type === 'REQUEST_POST_UPDATE_START', 2153 options: action.options || {} 2154 }; 2155 } 2156 return state; 2157 } 2158 2159 /** 2160 * Reducer returning deleting post request state. 2161 * 2162 * @param {Object} state Current state. 2163 * @param {Object} action Dispatched action. 2164 * 2165 * @return {Object} Updated state. 2166 */ 2167 function deleting(state = {}, action) { 2168 switch (action.type) { 2169 case 'REQUEST_POST_DELETE_START': 2170 case 'REQUEST_POST_DELETE_FINISH': 2171 return { 2172 pending: action.type === 'REQUEST_POST_DELETE_START' 2173 }; 2174 } 2175 return state; 2176 } 2177 2178 /** 2179 * Post Lock State. 2180 * 2181 * @typedef {Object} PostLockState 2182 * 2183 * @property {boolean} isLocked Whether the post is locked. 2184 * @property {?boolean} isTakeover Whether the post editing has been taken over. 2185 * @property {?boolean} activePostLock Active post lock value. 2186 * @property {?Object} user User that took over the post. 2187 */ 2188 2189 /** 2190 * Reducer returning the post lock status. 2191 * 2192 * @param {PostLockState} state Current state. 2193 * @param {Object} action Dispatched action. 2194 * 2195 * @return {PostLockState} Updated state. 2196 */ 2197 function postLock(state = { 2198 isLocked: false 2199 }, action) { 2200 switch (action.type) { 2201 case 'UPDATE_POST_LOCK': 2202 return action.lock; 2203 } 2204 return state; 2205 } 2206 2207 /** 2208 * Post saving lock. 2209 * 2210 * When post saving is locked, the post cannot be published or updated. 2211 * 2212 * @param {PostLockState} state Current state. 2213 * @param {Object} action Dispatched action. 2214 * 2215 * @return {PostLockState} Updated state. 2216 */ 2217 function postSavingLock(state = {}, action) { 2218 switch (action.type) { 2219 case 'LOCK_POST_SAVING': 2220 return { 2221 ...state, 2222 [action.lockName]: true 2223 }; 2224 case 'UNLOCK_POST_SAVING': 2225 { 2226 const { 2227 [action.lockName]: removedLockName, 2228 ...restState 2229 } = state; 2230 return restState; 2231 } 2232 } 2233 return state; 2234 } 2235 2236 /** 2237 * Post autosaving lock. 2238 * 2239 * When post autosaving is locked, the post will not autosave. 2240 * 2241 * @param {PostLockState} state Current state. 2242 * @param {Object} action Dispatched action. 2243 * 2244 * @return {PostLockState} Updated state. 2245 */ 2246 function postAutosavingLock(state = {}, action) { 2247 switch (action.type) { 2248 case 'LOCK_POST_AUTOSAVING': 2249 return { 2250 ...state, 2251 [action.lockName]: true 2252 }; 2253 case 'UNLOCK_POST_AUTOSAVING': 2254 { 2255 const { 2256 [action.lockName]: removedLockName, 2257 ...restState 2258 } = state; 2259 return restState; 2260 } 2261 } 2262 return state; 2263 } 2264 2265 /** 2266 * Reducer returning the post editor setting. 2267 * 2268 * @param {Object} state Current state. 2269 * @param {Object} action Dispatched action. 2270 * 2271 * @return {Object} Updated state. 2272 */ 2273 function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { 2274 switch (action.type) { 2275 case 'UPDATE_EDITOR_SETTINGS': 2276 return { 2277 ...state, 2278 ...action.settings 2279 }; 2280 } 2281 return state; 2282 } 2283 function renderingMode(state = 'post-only', action) { 2284 switch (action.type) { 2285 case 'SET_RENDERING_MODE': 2286 return action.mode; 2287 } 2288 return state; 2289 } 2290 2291 /** 2292 * Reducer returning the editing canvas device type. 2293 * 2294 * @param {Object} state Current state. 2295 * @param {Object} action Dispatched action. 2296 * 2297 * @return {Object} Updated state. 2298 */ 2299 function deviceType(state = 'Desktop', action) { 2300 switch (action.type) { 2301 case 'SET_DEVICE_TYPE': 2302 return action.deviceType; 2303 } 2304 return state; 2305 } 2306 2307 /** 2308 * Reducer storing the list of all programmatically removed panels. 2309 * 2310 * @param {Array} state Current state. 2311 * @param {Object} action Action object. 2312 * 2313 * @return {Array} Updated state. 2314 */ 2315 function removedPanels(state = [], action) { 2316 switch (action.type) { 2317 case 'REMOVE_PANEL': 2318 if (!state.includes(action.panelName)) { 2319 return [...state, action.panelName]; 2320 } 2321 } 2322 return state; 2323 } 2324 2325 /** 2326 * Reducer to set the block inserter panel open or closed. 2327 * 2328 * Note: this reducer interacts with the list view panel reducer 2329 * to make sure that only one of the two panels is open at the same time. 2330 * 2331 * @param {Object} state Current state. 2332 * @param {Object} action Dispatched action. 2333 */ 2334 function blockInserterPanel(state = false, action) { 2335 switch (action.type) { 2336 case 'SET_IS_LIST_VIEW_OPENED': 2337 return action.isOpen ? false : state; 2338 case 'SET_IS_INSERTER_OPENED': 2339 return action.value; 2340 } 2341 return state; 2342 } 2343 2344 /** 2345 * Reducer to set the list view panel open or closed. 2346 * 2347 * Note: this reducer interacts with the inserter panel reducer 2348 * to make sure that only one of the two panels is open at the same time. 2349 * 2350 * @param {Object} state Current state. 2351 * @param {Object} action Dispatched action. 2352 */ 2353 function listViewPanel(state = false, action) { 2354 switch (action.type) { 2355 case 'SET_IS_INSERTER_OPENED': 2356 return action.value ? false : state; 2357 case 'SET_IS_LIST_VIEW_OPENED': 2358 return action.isOpen; 2359 } 2360 return state; 2361 } 2362 2363 /** 2364 * This reducer does nothing aside initializing a ref to the list view toggle. 2365 * We will have a unique ref per "editor" instance. 2366 * 2367 * @param {Object} state 2368 * @return {Object} Reference to the list view toggle button. 2369 */ 2370 function listViewToggleRef(state = { 2371 current: null 2372 }) { 2373 return state; 2374 } 2375 2376 /** 2377 * This reducer does nothing aside initializing a ref to the inserter sidebar toggle. 2378 * We will have a unique ref per "editor" instance. 2379 * 2380 * @param {Object} state 2381 * @return {Object} Reference to the inserter sidebar toggle button. 2382 */ 2383 function inserterSidebarToggleRef(state = { 2384 current: null 2385 }) { 2386 return state; 2387 } 2388 function publishSidebarActive(state = false, action) { 2389 switch (action.type) { 2390 case 'OPEN_PUBLISH_SIDEBAR': 2391 return true; 2392 case 'CLOSE_PUBLISH_SIDEBAR': 2393 return false; 2394 case 'TOGGLE_PUBLISH_SIDEBAR': 2395 return !state; 2396 } 2397 return state; 2398 } 2399 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 2400 postId, 2401 postType, 2402 templateId, 2403 saving, 2404 deleting, 2405 postLock, 2406 template, 2407 postSavingLock, 2408 editorSettings, 2409 postAutosavingLock, 2410 renderingMode, 2411 deviceType, 2412 removedPanels, 2413 blockInserterPanel, 2414 inserterSidebarToggleRef, 2415 listViewPanel, 2416 listViewToggleRef, 2417 publishSidebarActive 2418 })); 2419 2420 ;// CONCATENATED MODULE: external ["wp","date"] 2421 const external_wp_date_namespaceObject = window["wp"]["date"]; 2422 ;// CONCATENATED MODULE: external ["wp","url"] 2423 const external_wp_url_namespaceObject = window["wp"]["url"]; 2424 ;// CONCATENATED MODULE: external ["wp","deprecated"] 2425 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 2426 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 2427 ;// CONCATENATED MODULE: external ["wp","element"] 2428 const external_wp_element_namespaceObject = window["wp"]["element"]; 2429 ;// CONCATENATED MODULE: external ["wp","primitives"] 2430 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 2431 ;// CONCATENATED MODULE: external "ReactJSXRuntime" 2432 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 2433 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 2434 /** 2435 * WordPress dependencies 2436 */ 2437 2438 2439 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2440 xmlns: "http://www.w3.org/2000/svg", 2441 viewBox: "0 0 24 24", 2442 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2443 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" 2444 }) 2445 }); 2446 /* harmony default export */ const library_layout = (layout); 2447 2448 ;// CONCATENATED MODULE: external ["wp","preferences"] 2449 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 2450 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js 2451 /** 2452 * Set of post properties for which edits should assume a merging behavior, 2453 * assuming an object value. 2454 * 2455 * @type {Set} 2456 */ 2457 const EDIT_MERGE_PROPERTIES = new Set(['meta']); 2458 2459 /** 2460 * Constant for the store module (or reducer) key. 2461 * 2462 * @type {string} 2463 */ 2464 const STORE_NAME = 'core/editor'; 2465 const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; 2466 const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; 2467 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 2468 const ONE_MINUTE_IN_MS = 60 * 1000; 2469 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; 2470 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; 2471 const TEMPLATE_POST_TYPE = 'wp_template'; 2472 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 2473 const PATTERN_POST_TYPE = 'wp_block'; 2474 const NAVIGATION_POST_TYPE = 'wp_navigation'; 2475 const TEMPLATE_ORIGINS = { 2476 custom: 'custom', 2477 theme: 'theme', 2478 plugin: 'plugin' 2479 }; 2480 const TEMPLATE_POST_TYPES = ['wp_template', 'wp_template_part']; 2481 const GLOBAL_POST_TYPES = [...TEMPLATE_POST_TYPES, 'wp_block', 'wp_navigation']; 2482 2483 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js 2484 /** 2485 * WordPress dependencies 2486 */ 2487 2488 2489 const header = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2490 xmlns: "http://www.w3.org/2000/svg", 2491 viewBox: "0 0 24 24", 2492 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2493 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" 2494 }) 2495 }); 2496 /* harmony default export */ const library_header = (header); 2497 2498 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js 2499 /** 2500 * WordPress dependencies 2501 */ 2502 2503 2504 const footer = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2505 xmlns: "http://www.w3.org/2000/svg", 2506 viewBox: "0 0 24 24", 2507 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2508 fillRule: "evenodd", 2509 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" 2510 }) 2511 }); 2512 /* harmony default export */ const library_footer = (footer); 2513 2514 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js 2515 /** 2516 * WordPress dependencies 2517 */ 2518 2519 2520 const sidebar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2521 xmlns: "http://www.w3.org/2000/svg", 2522 viewBox: "0 0 24 24", 2523 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2524 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" 2525 }) 2526 }); 2527 /* harmony default export */ const library_sidebar = (sidebar); 2528 2529 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 2530 /** 2531 * WordPress dependencies 2532 */ 2533 2534 2535 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2536 xmlns: "http://www.w3.org/2000/svg", 2537 viewBox: "0 0 24 24", 2538 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2539 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" 2540 }) 2541 }); 2542 /* harmony default export */ const symbol_filled = (symbolFilled); 2543 2544 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js 2545 /** 2546 * WordPress dependencies 2547 */ 2548 2549 /** 2550 * Helper function to retrieve the corresponding icon by name. 2551 * 2552 * @param {string} iconName The name of the icon. 2553 * 2554 * @return {Object} The corresponding icon. 2555 */ 2556 function getTemplatePartIcon(iconName) { 2557 if ('header' === iconName) { 2558 return library_header; 2559 } else if ('footer' === iconName) { 2560 return library_footer; 2561 } else if ('sidebar' === iconName) { 2562 return library_sidebar; 2563 } 2564 return symbol_filled; 2565 } 2566 2567 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js 2568 /** 2569 * WordPress dependencies 2570 */ 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 /** 2583 * Internal dependencies 2584 */ 2585 2586 2587 2588 2589 /** 2590 * Shared reference to an empty object for cases where it is important to avoid 2591 * returning a new object reference on every invocation, as in a connected or 2592 * other pure component which performs `shouldComponentUpdate` check on props. 2593 * This should be used as a last resort, since the normalized data should be 2594 * maintained by the reducer result in state. 2595 */ 2596 const EMPTY_OBJECT = {}; 2597 2598 /** 2599 * Returns true if any past editor history snapshots exist, or false otherwise. 2600 * 2601 * @param {Object} state Global application state. 2602 * 2603 * @return {boolean} Whether undo history exists. 2604 */ 2605 const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 2606 return select(external_wp_coreData_namespaceObject.store).hasUndo(); 2607 }); 2608 2609 /** 2610 * Returns true if any future editor history snapshots exist, or false 2611 * otherwise. 2612 * 2613 * @param {Object} state Global application state. 2614 * 2615 * @return {boolean} Whether redo history exists. 2616 */ 2617 const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 2618 return select(external_wp_coreData_namespaceObject.store).hasRedo(); 2619 }); 2620 2621 /** 2622 * Returns true if the currently edited post is yet to be saved, or false if 2623 * the post has been saved. 2624 * 2625 * @param {Object} state Global application state. 2626 * 2627 * @return {boolean} Whether the post is new. 2628 */ 2629 function isEditedPostNew(state) { 2630 return getCurrentPost(state).status === 'auto-draft'; 2631 } 2632 2633 /** 2634 * Returns true if content includes unsaved changes, or false otherwise. 2635 * 2636 * @param {Object} state Editor state. 2637 * 2638 * @return {boolean} Whether content includes unsaved changes. 2639 */ 2640 function hasChangedContent(state) { 2641 const edits = getPostEdits(state); 2642 return 'content' in edits; 2643 } 2644 2645 /** 2646 * Returns true if there are unsaved values for the current edit session, or 2647 * false if the editing state matches the saved or new post. 2648 * 2649 * @param {Object} state Global application state. 2650 * 2651 * @return {boolean} Whether unsaved values exist. 2652 */ 2653 const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2654 // Edits should contain only fields which differ from the saved post (reset 2655 // at initial load and save complete). Thus, a non-empty edits state can be 2656 // inferred to contain unsaved values. 2657 const postType = getCurrentPostType(state); 2658 const postId = getCurrentPostId(state); 2659 return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId); 2660 }); 2661 2662 /** 2663 * Returns true if there are unsaved edits for entities other than 2664 * the editor's post, and false otherwise. 2665 * 2666 * @param {Object} state Global application state. 2667 * 2668 * @return {boolean} Whether there are edits or not. 2669 */ 2670 const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2671 const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); 2672 const { 2673 type, 2674 id 2675 } = getCurrentPost(state); 2676 return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 2677 }); 2678 2679 /** 2680 * Returns true if there are no unsaved values for the current edit session and 2681 * if the currently edited post is new (has never been saved before). 2682 * 2683 * @param {Object} state Global application state. 2684 * 2685 * @return {boolean} Whether new post and unsaved values exist. 2686 */ 2687 function isCleanNewPost(state) { 2688 return !isEditedPostDirty(state) && isEditedPostNew(state); 2689 } 2690 2691 /** 2692 * Returns the post currently being edited in its last known saved state, not 2693 * including unsaved edits. Returns an object containing relevant default post 2694 * values if the post has not yet been saved. 2695 * 2696 * @param {Object} state Global application state. 2697 * 2698 * @return {Object} Post object. 2699 */ 2700 const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2701 const postId = getCurrentPostId(state); 2702 const postType = getCurrentPostType(state); 2703 const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId); 2704 if (post) { 2705 return post; 2706 } 2707 2708 // This exists for compatibility with the previous selector behavior 2709 // which would guarantee an object return based on the editor reducer's 2710 // default empty object state. 2711 return EMPTY_OBJECT; 2712 }); 2713 2714 /** 2715 * Returns the post type of the post currently being edited. 2716 * 2717 * @param {Object} state Global application state. 2718 * 2719 * @return {string} Post type. 2720 */ 2721 function getCurrentPostType(state) { 2722 return state.postType; 2723 } 2724 2725 /** 2726 * Returns the ID of the post currently being edited, or null if the post has 2727 * not yet been saved. 2728 * 2729 * @param {Object} state Global application state. 2730 * 2731 * @return {?number} ID of current post. 2732 */ 2733 function getCurrentPostId(state) { 2734 return state.postId; 2735 } 2736 2737 /** 2738 * Returns the template ID currently being rendered/edited 2739 * 2740 * @param {Object} state Global application state. 2741 * 2742 * @return {string?} Template ID. 2743 */ 2744 function getCurrentTemplateId(state) { 2745 return state.templateId; 2746 } 2747 2748 /** 2749 * Returns the number of revisions of the post currently being edited. 2750 * 2751 * @param {Object} state Global application state. 2752 * 2753 * @return {number} Number of revisions. 2754 */ 2755 function getCurrentPostRevisionsCount(state) { 2756 var _getCurrentPost$_link; 2757 return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0; 2758 } 2759 2760 /** 2761 * Returns the last revision ID of the post currently being edited, 2762 * or null if the post has no revisions. 2763 * 2764 * @param {Object} state Global application state. 2765 * 2766 * @return {?number} ID of the last revision. 2767 */ 2768 function getCurrentPostLastRevisionId(state) { 2769 var _getCurrentPost$_link2; 2770 return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null; 2771 } 2772 2773 /** 2774 * Returns any post values which have been changed in the editor but not yet 2775 * been saved. 2776 * 2777 * @param {Object} state Global application state. 2778 * 2779 * @return {Object} Object of key value pairs comprising unsaved edits. 2780 */ 2781 const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2782 const postType = getCurrentPostType(state); 2783 const postId = getCurrentPostId(state); 2784 return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; 2785 }); 2786 2787 /** 2788 * Returns an attribute value of the saved post. 2789 * 2790 * @param {Object} state Global application state. 2791 * @param {string} attributeName Post attribute name. 2792 * 2793 * @return {*} Post attribute value. 2794 */ 2795 function getCurrentPostAttribute(state, attributeName) { 2796 switch (attributeName) { 2797 case 'type': 2798 return getCurrentPostType(state); 2799 case 'id': 2800 return getCurrentPostId(state); 2801 default: 2802 const post = getCurrentPost(state); 2803 if (!post.hasOwnProperty(attributeName)) { 2804 break; 2805 } 2806 return getPostRawValue(post[attributeName]); 2807 } 2808 } 2809 2810 /** 2811 * Returns a single attribute of the post being edited, preferring the unsaved 2812 * edit if one exists, but merging with the attribute value for the last known 2813 * saved state of the post (this is needed for some nested attributes like meta). 2814 * 2815 * @param {Object} state Global application state. 2816 * @param {string} attributeName Post attribute name. 2817 * 2818 * @return {*} Post attribute value. 2819 */ 2820 const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)((state, attributeName) => { 2821 const edits = getPostEdits(state); 2822 if (!edits.hasOwnProperty(attributeName)) { 2823 return getCurrentPostAttribute(state, attributeName); 2824 } 2825 return { 2826 ...getCurrentPostAttribute(state, attributeName), 2827 ...edits[attributeName] 2828 }; 2829 }, (state, attributeName) => [getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName]]); 2830 2831 /** 2832 * Returns a single attribute of the post being edited, preferring the unsaved 2833 * edit if one exists, but falling back to the attribute for the last known 2834 * saved state of the post. 2835 * 2836 * @param {Object} state Global application state. 2837 * @param {string} attributeName Post attribute name. 2838 * 2839 * @return {*} Post attribute value. 2840 */ 2841 function getEditedPostAttribute(state, attributeName) { 2842 // Special cases. 2843 switch (attributeName) { 2844 case 'content': 2845 return getEditedPostContent(state); 2846 } 2847 2848 // Fall back to saved post value if not edited. 2849 const edits = getPostEdits(state); 2850 if (!edits.hasOwnProperty(attributeName)) { 2851 return getCurrentPostAttribute(state, attributeName); 2852 } 2853 2854 // Merge properties are objects which contain only the patch edit in state, 2855 // and thus must be merged with the current post attribute. 2856 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 2857 return getNestedEditedPostProperty(state, attributeName); 2858 } 2859 return edits[attributeName]; 2860 } 2861 2862 /** 2863 * Returns an attribute value of the current autosave revision for a post, or 2864 * null if there is no autosave for the post. 2865 * 2866 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector 2867 * from the '@wordpress/core-data' package and access properties on the returned 2868 * autosave object using getPostRawValue. 2869 * 2870 * @param {Object} state Global application state. 2871 * @param {string} attributeName Autosave attribute name. 2872 * 2873 * @return {*} Autosave attribute value. 2874 */ 2875 const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => { 2876 if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') { 2877 return; 2878 } 2879 const postType = getCurrentPostType(state); 2880 2881 // Currently template autosaving is not supported. 2882 if (postType === 'wp_template') { 2883 return false; 2884 } 2885 const postId = getCurrentPostId(state); 2886 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 2887 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 2888 if (autosave) { 2889 return getPostRawValue(autosave[attributeName]); 2890 } 2891 }); 2892 2893 /** 2894 * Returns the current visibility of the post being edited, preferring the 2895 * unsaved value if different than the saved post. The return value is one of 2896 * "private", "password", or "public". 2897 * 2898 * @param {Object} state Global application state. 2899 * 2900 * @return {string} Post visibility. 2901 */ 2902 function getEditedPostVisibility(state) { 2903 const status = getEditedPostAttribute(state, 'status'); 2904 if (status === 'private') { 2905 return 'private'; 2906 } 2907 const password = getEditedPostAttribute(state, 'password'); 2908 if (password) { 2909 return 'password'; 2910 } 2911 return 'public'; 2912 } 2913 2914 /** 2915 * Returns true if post is pending review. 2916 * 2917 * @param {Object} state Global application state. 2918 * 2919 * @return {boolean} Whether current post is pending review. 2920 */ 2921 function isCurrentPostPending(state) { 2922 return getCurrentPost(state).status === 'pending'; 2923 } 2924 2925 /** 2926 * Return true if the current post has already been published. 2927 * 2928 * @param {Object} state Global application state. 2929 * @param {Object?} currentPost Explicit current post for bypassing registry selector. 2930 * 2931 * @return {boolean} Whether the post has been published. 2932 */ 2933 function isCurrentPostPublished(state, currentPost) { 2934 const post = currentPost || getCurrentPost(state); 2935 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)); 2936 } 2937 2938 /** 2939 * Returns true if post is already scheduled. 2940 * 2941 * @param {Object} state Global application state. 2942 * 2943 * @return {boolean} Whether current post is scheduled to be posted. 2944 */ 2945 function isCurrentPostScheduled(state) { 2946 return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state); 2947 } 2948 2949 /** 2950 * Return true if the post being edited can be published. 2951 * 2952 * @param {Object} state Global application state. 2953 * 2954 * @return {boolean} Whether the post can been published. 2955 */ 2956 function isEditedPostPublishable(state) { 2957 const post = getCurrentPost(state); 2958 2959 // TODO: Post being publishable should be superset of condition of post 2960 // being saveable. Currently this restriction is imposed at UI. 2961 // 2962 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`). 2963 2964 return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; 2965 } 2966 2967 /** 2968 * Returns true if the post can be saved, or false otherwise. A post must 2969 * contain a title, an excerpt, or non-empty content to be valid for save. 2970 * 2971 * @param {Object} state Global application state. 2972 * 2973 * @return {boolean} Whether the post can be saved. 2974 */ 2975 function isEditedPostSaveable(state) { 2976 if (isSavingPost(state)) { 2977 return false; 2978 } 2979 2980 // TODO: Post should not be saveable if not dirty. Cannot be added here at 2981 // this time since posts where meta boxes are present can be saved even if 2982 // the post is not dirty. Currently this restriction is imposed at UI, but 2983 // should be moved here. 2984 // 2985 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) 2986 // See: <PostSavedState /> (`forceIsDirty` prop) 2987 // See: <PostPublishButton /> (`forceIsDirty` prop) 2988 // See: https://github.com/WordPress/gutenberg/pull/4184. 2989 2990 return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native'; 2991 } 2992 2993 /** 2994 * Returns true if the edited post has content. A post has content if it has at 2995 * least one saveable block or otherwise has a non-empty content property 2996 * assigned. 2997 * 2998 * @param {Object} state Global application state. 2999 * 3000 * @return {boolean} Whether post has content. 3001 */ 3002 const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3003 // While the condition of truthy content string is sufficient to determine 3004 // emptiness, testing saveable blocks length is a trivial operation. Since 3005 // this function can be called frequently, optimize for the fast case as a 3006 // condition of the mere existence of blocks. Note that the value of edited 3007 // content takes precedent over block content, and must fall through to the 3008 // default logic. 3009 const postId = getCurrentPostId(state); 3010 const postType = getCurrentPostType(state); 3011 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 3012 if (typeof record.content !== 'function') { 3013 return !record.content; 3014 } 3015 const blocks = getEditedPostAttribute(state, 'blocks'); 3016 if (blocks.length === 0) { 3017 return true; 3018 } 3019 3020 // Pierce the abstraction of the serializer in knowing that blocks are 3021 // joined with newlines such that even if every individual block 3022 // produces an empty save result, the serialized content is non-empty. 3023 if (blocks.length > 1) { 3024 return false; 3025 } 3026 3027 // There are two conditions under which the optimization cannot be 3028 // assumed, and a fallthrough to getEditedPostContent must occur: 3029 // 3030 // 1. getBlocksForSerialization has special treatment in omitting a 3031 // single unmodified default block. 3032 // 2. Comment delimiters are omitted for a freeform or unregistered 3033 // block in its serialization. The freeform block specifically may 3034 // produce an empty string in its saved output. 3035 // 3036 // For all other content, the single block is assumed to make a post 3037 // non-empty, if only by virtue of its own comment delimiters. 3038 const blockName = blocks[0].name; 3039 if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { 3040 return false; 3041 } 3042 return !getEditedPostContent(state); 3043 }); 3044 3045 /** 3046 * Returns true if the post can be autosaved, or false otherwise. 3047 * 3048 * @param {Object} state Global application state. 3049 * @param {Object} autosave A raw autosave object from the REST API. 3050 * 3051 * @return {boolean} Whether the post can be autosaved. 3052 */ 3053 const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3054 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. 3055 if (!isEditedPostSaveable(state)) { 3056 return false; 3057 } 3058 3059 // A post is not autosavable when there is a post autosave lock. 3060 if (isPostAutosavingLocked(state)) { 3061 return false; 3062 } 3063 const postType = getCurrentPostType(state); 3064 3065 // Currently template autosaving is not supported. 3066 if (postType === 'wp_template') { 3067 return false; 3068 } 3069 const postId = getCurrentPostId(state); 3070 const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId); 3071 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 3072 3073 // Disable reason - this line causes the side-effect of fetching the autosave 3074 // via a resolver, moving below the return would result in the autosave never 3075 // being fetched. 3076 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 3077 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 3078 3079 // If any existing autosaves have not yet been fetched, this function is 3080 // unable to determine if the post is autosaveable, so return false. 3081 if (!hasFetchedAutosave) { 3082 return false; 3083 } 3084 3085 // If we don't already have an autosave, the post is autosaveable. 3086 if (!autosave) { 3087 return true; 3088 } 3089 3090 // To avoid an expensive content serialization, use the content dirtiness 3091 // flag in place of content field comparison against the known autosave. 3092 // This is not strictly accurate, and relies on a tolerance toward autosave 3093 // request failures for unnecessary saves. 3094 if (hasChangedContent(state)) { 3095 return true; 3096 } 3097 3098 // If title, excerpt, or meta have changed, the post is autosaveable. 3099 return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); 3100 }); 3101 3102 /** 3103 * Return true if the post being edited is being scheduled. Preferring the 3104 * unsaved status values. 3105 * 3106 * @param {Object} state Global application state. 3107 * 3108 * @return {boolean} Whether the post has been published. 3109 */ 3110 function isEditedPostBeingScheduled(state) { 3111 const date = getEditedPostAttribute(state, 'date'); 3112 // Offset the date by one minute (network latency). 3113 const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS); 3114 return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); 3115 } 3116 3117 /** 3118 * Returns whether the current post should be considered to have a "floating" 3119 * date (i.e. that it would publish "Immediately" rather than at a set time). 3120 * 3121 * Unlike in the PHP backend, the REST API returns a full date string for posts 3122 * where the 0000-00-00T00:00:00 placeholder is present in the database. To 3123 * infer that a post is set to publish "Immediately" we check whether the date 3124 * and modified date are the same. 3125 * 3126 * @param {Object} state Editor state. 3127 * 3128 * @return {boolean} Whether the edited post has a floating date value. 3129 */ 3130 function isEditedPostDateFloating(state) { 3131 const date = getEditedPostAttribute(state, 'date'); 3132 const modified = getEditedPostAttribute(state, 'modified'); 3133 3134 // This should be the status of the persisted post 3135 // It shouldn't use the "edited" status otherwise it breaks the 3136 // inferred post data floating status 3137 // See https://github.com/WordPress/gutenberg/issues/28083. 3138 const status = getCurrentPost(state).status; 3139 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { 3140 return date === modified || date === null; 3141 } 3142 return false; 3143 } 3144 3145 /** 3146 * Returns true if the post is currently being deleted, or false otherwise. 3147 * 3148 * @param {Object} state Editor state. 3149 * 3150 * @return {boolean} Whether post is being deleted. 3151 */ 3152 function isDeletingPost(state) { 3153 return !!state.deleting.pending; 3154 } 3155 3156 /** 3157 * Returns true if the post is currently being saved, or false otherwise. 3158 * 3159 * @param {Object} state Global application state. 3160 * 3161 * @return {boolean} Whether post is being saved. 3162 */ 3163 function isSavingPost(state) { 3164 return !!state.saving.pending; 3165 } 3166 3167 /** 3168 * Returns true if non-post entities are currently being saved, or false otherwise. 3169 * 3170 * @param {Object} state Global application state. 3171 * 3172 * @return {boolean} Whether non-post entities are being saved. 3173 */ 3174 const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3175 const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); 3176 const { 3177 type, 3178 id 3179 } = getCurrentPost(state); 3180 return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 3181 }); 3182 3183 /** 3184 * Returns true if a previous post save was attempted successfully, or false 3185 * otherwise. 3186 * 3187 * @param {Object} state Global application state. 3188 * 3189 * @return {boolean} Whether the post was saved successfully. 3190 */ 3191 const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3192 const postType = getCurrentPostType(state); 3193 const postId = getCurrentPostId(state); 3194 return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 3195 }); 3196 3197 /** 3198 * Returns true if a previous post save was attempted but failed, or false 3199 * otherwise. 3200 * 3201 * @param {Object} state Global application state. 3202 * 3203 * @return {boolean} Whether the post save failed. 3204 */ 3205 const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3206 const postType = getCurrentPostType(state); 3207 const postId = getCurrentPostId(state); 3208 return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 3209 }); 3210 3211 /** 3212 * Returns true if the post is autosaving, or false otherwise. 3213 * 3214 * @param {Object} state Global application state. 3215 * 3216 * @return {boolean} Whether the post is autosaving. 3217 */ 3218 function isAutosavingPost(state) { 3219 return isSavingPost(state) && Boolean(state.saving.options?.isAutosave); 3220 } 3221 3222 /** 3223 * Returns true if the post is being previewed, or false otherwise. 3224 * 3225 * @param {Object} state Global application state. 3226 * 3227 * @return {boolean} Whether the post is being previewed. 3228 */ 3229 function isPreviewingPost(state) { 3230 return isSavingPost(state) && Boolean(state.saving.options?.isPreview); 3231 } 3232 3233 /** 3234 * Returns the post preview link 3235 * 3236 * @param {Object} state Global application state. 3237 * 3238 * @return {string | undefined} Preview Link. 3239 */ 3240 function getEditedPostPreviewLink(state) { 3241 if (state.saving.pending || isSavingPost(state)) { 3242 return; 3243 } 3244 let previewLink = getAutosaveAttribute(state, 'preview_link'); 3245 // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616 3246 // If the post is draft, ignore the preview link from the autosave record, 3247 // because the preview could be a stale autosave if the post was switched from 3248 // published to draft. 3249 // See: https://github.com/WordPress/gutenberg/pull/37952. 3250 if (!previewLink || 'draft' === getCurrentPost(state).status) { 3251 previewLink = getEditedPostAttribute(state, 'link'); 3252 if (previewLink) { 3253 previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 3254 preview: true 3255 }); 3256 } 3257 } 3258 const featuredImageId = getEditedPostAttribute(state, 'featured_media'); 3259 if (previewLink && featuredImageId) { 3260 return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 3261 _thumbnail_id: featuredImageId 3262 }); 3263 } 3264 return previewLink; 3265 } 3266 3267 /** 3268 * Returns a suggested post format for the current post, inferred only if there 3269 * is a single block within the post and it is of a type known to match a 3270 * default post format. Returns null if the format cannot be determined. 3271 * 3272 * @return {?string} Suggested post format. 3273 */ 3274 const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3275 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); 3276 if (blocks.length > 2) { 3277 return null; 3278 } 3279 let name; 3280 // If there is only one block in the content of the post grab its name 3281 // so we can derive a suitable post format from it. 3282 if (blocks.length === 1) { 3283 name = blocks[0].name; 3284 // Check for core/embed `video` and `audio` eligible suggestions. 3285 if (name === 'core/embed') { 3286 const provider = blocks[0].attributes?.providerNameSlug; 3287 if (['youtube', 'vimeo'].includes(provider)) { 3288 name = 'core/video'; 3289 } else if (['spotify', 'soundcloud'].includes(provider)) { 3290 name = 'core/audio'; 3291 } 3292 } 3293 } 3294 3295 // If there are two blocks in the content and the last one is a text blocks 3296 // grab the name of the first one to also suggest a post format from it. 3297 if (blocks.length === 2 && blocks[1].name === 'core/paragraph') { 3298 name = blocks[0].name; 3299 } 3300 3301 // We only convert to default post formats in core. 3302 switch (name) { 3303 case 'core/image': 3304 return 'image'; 3305 case 'core/quote': 3306 case 'core/pullquote': 3307 return 'quote'; 3308 case 'core/gallery': 3309 return 'gallery'; 3310 case 'core/video': 3311 return 'video'; 3312 case 'core/audio': 3313 return 'audio'; 3314 default: 3315 return null; 3316 } 3317 }); 3318 3319 /** 3320 * Returns the content of the post being edited. 3321 * 3322 * @param {Object} state Global application state. 3323 * 3324 * @return {string} Post content. 3325 */ 3326 const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3327 const postId = getCurrentPostId(state); 3328 const postType = getCurrentPostType(state); 3329 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 3330 if (record) { 3331 if (typeof record.content === 'function') { 3332 return record.content(record); 3333 } else if (record.blocks) { 3334 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 3335 } else if (record.content) { 3336 return record.content; 3337 } 3338 } 3339 return ''; 3340 }); 3341 3342 /** 3343 * Returns true if the post is being published, or false otherwise. 3344 * 3345 * @param {Object} state Global application state. 3346 * 3347 * @return {boolean} Whether post is being published. 3348 */ 3349 function isPublishingPost(state) { 3350 return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish'; 3351 } 3352 3353 /** 3354 * Returns whether the permalink is editable or not. 3355 * 3356 * @param {Object} state Editor state. 3357 * 3358 * @return {boolean} Whether or not the permalink is editable. 3359 */ 3360 function isPermalinkEditable(state) { 3361 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 3362 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 3363 } 3364 3365 /** 3366 * Returns the permalink for the post. 3367 * 3368 * @param {Object} state Editor state. 3369 * 3370 * @return {?string} The permalink, or null if the post is not viewable. 3371 */ 3372 function getPermalink(state) { 3373 const permalinkParts = getPermalinkParts(state); 3374 if (!permalinkParts) { 3375 return null; 3376 } 3377 const { 3378 prefix, 3379 postName, 3380 suffix 3381 } = permalinkParts; 3382 if (isPermalinkEditable(state)) { 3383 return prefix + postName + suffix; 3384 } 3385 return prefix; 3386 } 3387 3388 /** 3389 * Returns the slug for the post being edited, preferring a manually edited 3390 * value if one exists, then a sanitized version of the current post title, and 3391 * finally the post ID. 3392 * 3393 * @param {Object} state Editor state. 3394 * 3395 * @return {string} The current slug to be displayed in the editor 3396 */ 3397 function getEditedPostSlug(state) { 3398 return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state); 3399 } 3400 3401 /** 3402 * Returns the permalink for a post, split into its three parts: the prefix, 3403 * the postName, and the suffix. 3404 * 3405 * @param {Object} state Editor state. 3406 * 3407 * @return {Object} An object containing the prefix, postName, and suffix for 3408 * the permalink, or null if the post is not viewable. 3409 */ 3410 function getPermalinkParts(state) { 3411 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 3412 if (!permalinkTemplate) { 3413 return null; 3414 } 3415 const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug'); 3416 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); 3417 return { 3418 prefix, 3419 postName, 3420 suffix 3421 }; 3422 } 3423 3424 /** 3425 * Returns whether the post is locked. 3426 * 3427 * @param {Object} state Global application state. 3428 * 3429 * @return {boolean} Is locked. 3430 */ 3431 function isPostLocked(state) { 3432 return state.postLock.isLocked; 3433 } 3434 3435 /** 3436 * Returns whether post saving is locked. 3437 * 3438 * @param {Object} state Global application state. 3439 * 3440 * @return {boolean} Is locked. 3441 */ 3442 function isPostSavingLocked(state) { 3443 return Object.keys(state.postSavingLock).length > 0; 3444 } 3445 3446 /** 3447 * Returns whether post autosaving is locked. 3448 * 3449 * @param {Object} state Global application state. 3450 * 3451 * @return {boolean} Is locked. 3452 */ 3453 function isPostAutosavingLocked(state) { 3454 return Object.keys(state.postAutosavingLock).length > 0; 3455 } 3456 3457 /** 3458 * Returns whether the edition of the post has been taken over. 3459 * 3460 * @param {Object} state Global application state. 3461 * 3462 * @return {boolean} Is post lock takeover. 3463 */ 3464 function isPostLockTakeover(state) { 3465 return state.postLock.isTakeover; 3466 } 3467 3468 /** 3469 * Returns details about the post lock user. 3470 * 3471 * @param {Object} state Global application state. 3472 * 3473 * @return {Object} A user object. 3474 */ 3475 function getPostLockUser(state) { 3476 return state.postLock.user; 3477 } 3478 3479 /** 3480 * Returns the active post lock. 3481 * 3482 * @param {Object} state Global application state. 3483 * 3484 * @return {Object} The lock object. 3485 */ 3486 function getActivePostLock(state) { 3487 return state.postLock.activePostLock; 3488 } 3489 3490 /** 3491 * Returns whether or not the user has the unfiltered_html capability. 3492 * 3493 * @param {Object} state Editor state. 3494 * 3495 * @return {boolean} Whether the user can or can't post unfiltered HTML. 3496 */ 3497 function canUserUseUnfilteredHTML(state) { 3498 return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html')); 3499 } 3500 3501 /** 3502 * Returns whether the pre-publish panel should be shown 3503 * or skipped when the user clicks the "publish" button. 3504 * 3505 * @return {boolean} Whether the pre-publish panel should be shown or not. 3506 */ 3507 const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core', 'isPublishSidebarEnabled')); 3508 3509 /** 3510 * Return the current block list. 3511 * 3512 * @param {Object} state 3513 * @return {Array} Block list. 3514 */ 3515 const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { 3516 return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state)); 3517 }, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]); 3518 3519 /** 3520 * Returns true if the given panel was programmatically removed, or false otherwise. 3521 * All panels are not removed by default. 3522 * 3523 * @param {Object} state Global application state. 3524 * @param {string} panelName A string that identifies the panel. 3525 * 3526 * @return {boolean} Whether or not the panel is removed. 3527 */ 3528 function isEditorPanelRemoved(state, panelName) { 3529 return state.removedPanels.includes(panelName); 3530 } 3531 3532 /** 3533 * Returns true if the given panel is enabled, or false otherwise. Panels are 3534 * enabled by default. 3535 * 3536 * @param {Object} state Global application state. 3537 * @param {string} panelName A string that identifies the panel. 3538 * 3539 * @return {boolean} Whether or not the panel is enabled. 3540 */ 3541 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3542 // For backward compatibility, we check edit-post 3543 // even though now this is in "editor" package. 3544 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); 3545 return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); 3546 }); 3547 3548 /** 3549 * Returns true if the given panel is open, or false otherwise. Panels are 3550 * closed by default. 3551 * 3552 * @param {Object} state Global application state. 3553 * @param {string} panelName A string that identifies the panel. 3554 * 3555 * @return {boolean} Whether or not the panel is open. 3556 */ 3557 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3558 // For backward compatibility, we check edit-post 3559 // even though now this is in "editor" package. 3560 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); 3561 return !!openPanels?.includes(panelName); 3562 }); 3563 3564 /** 3565 * A block selection object. 3566 * 3567 * @typedef {Object} WPBlockSelection 3568 * 3569 * @property {string} clientId A block client ID. 3570 * @property {string} attributeKey A block attribute key. 3571 * @property {number} offset An attribute value offset, based on the rich 3572 * text value. See `wp.richText.create`. 3573 */ 3574 3575 /** 3576 * Returns the current selection start. 3577 * 3578 * @param {Object} state 3579 * @return {WPBlockSelection} The selection start. 3580 * 3581 * @deprecated since Gutenberg 10.0.0. 3582 */ 3583 function getEditorSelectionStart(state) { 3584 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 3585 since: '5.8', 3586 alternative: "select('core/editor').getEditorSelection" 3587 }); 3588 return getEditedPostAttribute(state, 'selection')?.selectionStart; 3589 } 3590 3591 /** 3592 * Returns the current selection end. 3593 * 3594 * @param {Object} state 3595 * @return {WPBlockSelection} The selection end. 3596 * 3597 * @deprecated since Gutenberg 10.0.0. 3598 */ 3599 function getEditorSelectionEnd(state) { 3600 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 3601 since: '5.8', 3602 alternative: "select('core/editor').getEditorSelection" 3603 }); 3604 return getEditedPostAttribute(state, 'selection')?.selectionEnd; 3605 } 3606 3607 /** 3608 * Returns the current selection. 3609 * 3610 * @param {Object} state 3611 * @return {WPBlockSelection} The selection end. 3612 */ 3613 function getEditorSelection(state) { 3614 return getEditedPostAttribute(state, 'selection'); 3615 } 3616 3617 /** 3618 * Is the editor ready 3619 * 3620 * @param {Object} state 3621 * @return {boolean} is Ready. 3622 */ 3623 function __unstableIsEditorReady(state) { 3624 return !!state.postId; 3625 } 3626 3627 /** 3628 * Returns the post editor settings. 3629 * 3630 * @param {Object} state Editor state. 3631 * 3632 * @return {Object} The editor settings object. 3633 */ 3634 function getEditorSettings(state) { 3635 return state.editorSettings; 3636 } 3637 3638 /** 3639 * Returns the post editor's rendering mode. 3640 * 3641 * @param {Object} state Editor state. 3642 * 3643 * @return {string} Rendering mode. 3644 */ 3645 function getRenderingMode(state) { 3646 return state.renderingMode; 3647 } 3648 3649 /** 3650 * Returns the current editing canvas device type. 3651 * 3652 * @param {Object} state Global application state. 3653 * 3654 * @return {string} Device type. 3655 */ 3656 function getDeviceType(state) { 3657 return state.deviceType; 3658 } 3659 3660 /** 3661 * Returns true if the list view is opened. 3662 * 3663 * @param {Object} state Global application state. 3664 * 3665 * @return {boolean} Whether the list view is opened. 3666 */ 3667 function isListViewOpened(state) { 3668 return state.listViewPanel; 3669 } 3670 3671 /** 3672 * Returns true if the inserter is opened. 3673 * 3674 * @param {Object} state Global application state. 3675 * 3676 * @return {boolean} Whether the inserter is opened. 3677 */ 3678 function isInserterOpened(state) { 3679 return !!state.blockInserterPanel; 3680 } 3681 3682 /** 3683 * Returns the current editing mode. 3684 * 3685 * @param {Object} state Global application state. 3686 * 3687 * @return {string} Editing mode. 3688 */ 3689 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3690 var _select$get; 3691 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; 3692 }); 3693 3694 /* 3695 * Backward compatibility 3696 */ 3697 3698 /** 3699 * Returns state object prior to a specified optimist transaction ID, or `null` 3700 * if the transaction corresponding to the given ID cannot be found. 3701 * 3702 * @deprecated since Gutenberg 9.7.0. 3703 */ 3704 function getStateBeforeOptimisticTransaction() { 3705 external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { 3706 since: '5.7', 3707 hint: 'No state history is kept on this store anymore' 3708 }); 3709 return null; 3710 } 3711 /** 3712 * Returns true if an optimistic transaction is pending commit, for which the 3713 * before state satisfies the given predicate function. 3714 * 3715 * @deprecated since Gutenberg 9.7.0. 3716 */ 3717 function inSomeHistory() { 3718 external_wp_deprecated_default()("select('core/editor').inSomeHistory", { 3719 since: '5.7', 3720 hint: 'No state history is kept on this store anymore' 3721 }); 3722 return false; 3723 } 3724 function getBlockEditorSelector(name) { 3725 return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ...args) => { 3726 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { 3727 since: '5.3', 3728 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`', 3729 version: '6.2' 3730 }); 3731 return select(external_wp_blockEditor_namespaceObject.store)[name](...args); 3732 }); 3733 } 3734 3735 /** 3736 * @see getBlockName in core/block-editor store. 3737 */ 3738 const getBlockName = getBlockEditorSelector('getBlockName'); 3739 3740 /** 3741 * @see isBlockValid in core/block-editor store. 3742 */ 3743 const isBlockValid = getBlockEditorSelector('isBlockValid'); 3744 3745 /** 3746 * @see getBlockAttributes in core/block-editor store. 3747 */ 3748 const getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); 3749 3750 /** 3751 * @see getBlock in core/block-editor store. 3752 */ 3753 const getBlock = getBlockEditorSelector('getBlock'); 3754 3755 /** 3756 * @see getBlocks in core/block-editor store. 3757 */ 3758 const getBlocks = getBlockEditorSelector('getBlocks'); 3759 3760 /** 3761 * @see getClientIdsOfDescendants in core/block-editor store. 3762 */ 3763 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); 3764 3765 /** 3766 * @see getClientIdsWithDescendants in core/block-editor store. 3767 */ 3768 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); 3769 3770 /** 3771 * @see getGlobalBlockCount in core/block-editor store. 3772 */ 3773 const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); 3774 3775 /** 3776 * @see getBlocksByClientId in core/block-editor store. 3777 */ 3778 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); 3779 3780 /** 3781 * @see getBlockCount in core/block-editor store. 3782 */ 3783 const getBlockCount = getBlockEditorSelector('getBlockCount'); 3784 3785 /** 3786 * @see getBlockSelectionStart in core/block-editor store. 3787 */ 3788 const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); 3789 3790 /** 3791 * @see getBlockSelectionEnd in core/block-editor store. 3792 */ 3793 const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); 3794 3795 /** 3796 * @see getSelectedBlockCount in core/block-editor store. 3797 */ 3798 const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); 3799 3800 /** 3801 * @see hasSelectedBlock in core/block-editor store. 3802 */ 3803 const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); 3804 3805 /** 3806 * @see getSelectedBlockClientId in core/block-editor store. 3807 */ 3808 const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); 3809 3810 /** 3811 * @see getSelectedBlock in core/block-editor store. 3812 */ 3813 const getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); 3814 3815 /** 3816 * @see getBlockRootClientId in core/block-editor store. 3817 */ 3818 const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); 3819 3820 /** 3821 * @see getBlockHierarchyRootClientId in core/block-editor store. 3822 */ 3823 const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); 3824 3825 /** 3826 * @see getAdjacentBlockClientId in core/block-editor store. 3827 */ 3828 const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); 3829 3830 /** 3831 * @see getPreviousBlockClientId in core/block-editor store. 3832 */ 3833 const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); 3834 3835 /** 3836 * @see getNextBlockClientId in core/block-editor store. 3837 */ 3838 const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); 3839 3840 /** 3841 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. 3842 */ 3843 const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); 3844 3845 /** 3846 * @see getMultiSelectedBlockClientIds in core/block-editor store. 3847 */ 3848 const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); 3849 3850 /** 3851 * @see getMultiSelectedBlocks in core/block-editor store. 3852 */ 3853 const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); 3854 3855 /** 3856 * @see getFirstMultiSelectedBlockClientId in core/block-editor store. 3857 */ 3858 const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); 3859 3860 /** 3861 * @see getLastMultiSelectedBlockClientId in core/block-editor store. 3862 */ 3863 const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); 3864 3865 /** 3866 * @see isFirstMultiSelectedBlock in core/block-editor store. 3867 */ 3868 const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); 3869 3870 /** 3871 * @see isBlockMultiSelected in core/block-editor store. 3872 */ 3873 const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); 3874 3875 /** 3876 * @see isAncestorMultiSelected in core/block-editor store. 3877 */ 3878 const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); 3879 3880 /** 3881 * @see getMultiSelectedBlocksStartClientId in core/block-editor store. 3882 */ 3883 const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); 3884 3885 /** 3886 * @see getMultiSelectedBlocksEndClientId in core/block-editor store. 3887 */ 3888 const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); 3889 3890 /** 3891 * @see getBlockOrder in core/block-editor store. 3892 */ 3893 const getBlockOrder = getBlockEditorSelector('getBlockOrder'); 3894 3895 /** 3896 * @see getBlockIndex in core/block-editor store. 3897 */ 3898 const getBlockIndex = getBlockEditorSelector('getBlockIndex'); 3899 3900 /** 3901 * @see isBlockSelected in core/block-editor store. 3902 */ 3903 const isBlockSelected = getBlockEditorSelector('isBlockSelected'); 3904 3905 /** 3906 * @see hasSelectedInnerBlock in core/block-editor store. 3907 */ 3908 const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); 3909 3910 /** 3911 * @see isBlockWithinSelection in core/block-editor store. 3912 */ 3913 const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); 3914 3915 /** 3916 * @see hasMultiSelection in core/block-editor store. 3917 */ 3918 const hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); 3919 3920 /** 3921 * @see isMultiSelecting in core/block-editor store. 3922 */ 3923 const isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); 3924 3925 /** 3926 * @see isSelectionEnabled in core/block-editor store. 3927 */ 3928 const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); 3929 3930 /** 3931 * @see getBlockMode in core/block-editor store. 3932 */ 3933 const getBlockMode = getBlockEditorSelector('getBlockMode'); 3934 3935 /** 3936 * @see isTyping in core/block-editor store. 3937 */ 3938 const isTyping = getBlockEditorSelector('isTyping'); 3939 3940 /** 3941 * @see isCaretWithinFormattedText in core/block-editor store. 3942 */ 3943 const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); 3944 3945 /** 3946 * @see getBlockInsertionPoint in core/block-editor store. 3947 */ 3948 const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); 3949 3950 /** 3951 * @see isBlockInsertionPointVisible in core/block-editor store. 3952 */ 3953 const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); 3954 3955 /** 3956 * @see isValidTemplate in core/block-editor store. 3957 */ 3958 const isValidTemplate = getBlockEditorSelector('isValidTemplate'); 3959 3960 /** 3961 * @see getTemplate in core/block-editor store. 3962 */ 3963 const getTemplate = getBlockEditorSelector('getTemplate'); 3964 3965 /** 3966 * @see getTemplateLock in core/block-editor store. 3967 */ 3968 const getTemplateLock = getBlockEditorSelector('getTemplateLock'); 3969 3970 /** 3971 * @see canInsertBlockType in core/block-editor store. 3972 */ 3973 const canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); 3974 3975 /** 3976 * @see getInserterItems in core/block-editor store. 3977 */ 3978 const getInserterItems = getBlockEditorSelector('getInserterItems'); 3979 3980 /** 3981 * @see hasInserterItems in core/block-editor store. 3982 */ 3983 const hasInserterItems = getBlockEditorSelector('hasInserterItems'); 3984 3985 /** 3986 * @see getBlockListSettings in core/block-editor store. 3987 */ 3988 const getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); 3989 3990 /** 3991 * Returns the default template types. 3992 * 3993 * @param {Object} state Global application state. 3994 * 3995 * @return {Object} The template types. 3996 */ 3997 function __experimentalGetDefaultTemplateTypes(state) { 3998 return getEditorSettings(state)?.defaultTemplateTypes; 3999 } 4000 4001 /** 4002 * Returns the default template part areas. 4003 * 4004 * @param {Object} state Global application state. 4005 * 4006 * @return {Array} The template part areas. 4007 */ 4008 const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createSelector)(state => { 4009 var _getEditorSettings$de; 4010 const areas = (_getEditorSettings$de = getEditorSettings(state)?.defaultTemplatePartAreas) !== null && _getEditorSettings$de !== void 0 ? _getEditorSettings$de : []; 4011 return areas.map(item => { 4012 return { 4013 ...item, 4014 icon: getTemplatePartIcon(item.icon) 4015 }; 4016 }); 4017 }, state => [getEditorSettings(state)?.defaultTemplatePartAreas]); 4018 4019 /** 4020 * Returns a default template type searched by slug. 4021 * 4022 * @param {Object} state Global application state. 4023 * @param {string} slug The template type slug. 4024 * 4025 * @return {Object} The template type. 4026 */ 4027 const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createSelector)((state, slug) => { 4028 var _Object$values$find; 4029 const templateTypes = __experimentalGetDefaultTemplateTypes(state); 4030 if (!templateTypes) { 4031 return EMPTY_OBJECT; 4032 } 4033 return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT; 4034 }, state => [__experimentalGetDefaultTemplateTypes(state)]); 4035 4036 /** 4037 * Given a template entity, return information about it which is ready to be 4038 * rendered, such as the title, description, and icon. 4039 * 4040 * @param {Object} state Global application state. 4041 * @param {Object} template The template for which we need information. 4042 * @return {Object} Information about the template, including title, description, and icon. 4043 */ 4044 const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createSelector)((state, template) => { 4045 if (!template) { 4046 return EMPTY_OBJECT; 4047 } 4048 const { 4049 description, 4050 slug, 4051 title, 4052 area 4053 } = template; 4054 const { 4055 title: defaultTitle, 4056 description: defaultDescription 4057 } = __experimentalGetDefaultTemplateType(state, slug); 4058 const templateTitle = typeof title === 'string' ? title : title?.rendered; 4059 const templateDescription = typeof description === 'string' ? description : description?.raw; 4060 const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || library_layout; 4061 return { 4062 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 4063 description: templateDescription || defaultDescription, 4064 icon: templateIcon 4065 }; 4066 }, state => [__experimentalGetDefaultTemplateTypes(state), __experimentalGetDefaultTemplatePartAreas(state)]); 4067 4068 /** 4069 * Returns a post type label depending on the current post. 4070 * 4071 * @param {Object} state Global application state. 4072 * 4073 * @return {string|undefined} The post type label if available, otherwise undefined. 4074 */ 4075 const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 4076 const currentPostType = getCurrentPostType(state); 4077 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); 4078 // Disable reason: Post type labels object is shaped like this. 4079 // eslint-disable-next-line camelcase 4080 return postType?.labels?.singular_name; 4081 }); 4082 4083 /** 4084 * Returns true if the publish sidebar is opened. 4085 * 4086 * @param {Object} state Global application state 4087 * 4088 * @return {boolean} Whether the publish sidebar is open. 4089 */ 4090 function isPublishSidebarOpened(state) { 4091 return state.publishSidebarActive; 4092 } 4093 4094 ;// CONCATENATED MODULE: external ["wp","a11y"] 4095 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 4096 ;// CONCATENATED MODULE: external ["wp","apiFetch"] 4097 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 4098 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 4099 ;// CONCATENATED MODULE: external ["wp","notices"] 4100 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 4101 ;// CONCATENATED MODULE: external ["wp","hooks"] 4102 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 4103 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js 4104 /** 4105 * Function returning a sessionStorage key to set or retrieve a given post's 4106 * automatic session backup. 4107 * 4108 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's 4109 * `loggedout` handler can clear sessionStorage of any user-private content. 4110 * 4111 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 4112 * 4113 * @param {string} postId Post ID. 4114 * @param {boolean} isPostNew Whether post new. 4115 * 4116 * @return {string} sessionStorage key 4117 */ 4118 function postKey(postId, isPostNew) { 4119 return `wp-autosave-block-editor-post-$isPostNew ? 'auto-draft' : postId}`; 4120 } 4121 function localAutosaveGet(postId, isPostNew) { 4122 return window.sessionStorage.getItem(postKey(postId, isPostNew)); 4123 } 4124 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { 4125 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ 4126 post_title: title, 4127 content, 4128 excerpt 4129 })); 4130 } 4131 function localAutosaveClear(postId, isPostNew) { 4132 window.sessionStorage.removeItem(postKey(postId, isPostNew)); 4133 } 4134 4135 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js 4136 /** 4137 * WordPress dependencies 4138 */ 4139 4140 4141 /** 4142 * Internal dependencies 4143 */ 4144 4145 4146 /** 4147 * Builds the arguments for a success notification dispatch. 4148 * 4149 * @param {Object} data Incoming data to build the arguments from. 4150 * 4151 * @return {Array} Arguments for dispatch. An empty array signals no 4152 * notification should be sent. 4153 */ 4154 function getNotificationArgumentsForSaveSuccess(data) { 4155 var _postType$viewable; 4156 const { 4157 previousPost, 4158 post, 4159 postType 4160 } = data; 4161 // Autosaves are neither shown a notice nor redirected. 4162 if (data.options?.isAutosave) { 4163 return []; 4164 } 4165 const publishStatus = ['publish', 'private', 'future']; 4166 const isPublished = publishStatus.includes(previousPost.status); 4167 const willPublish = publishStatus.includes(post.status); 4168 const willTrash = post.status === 'trash' && previousPost.status !== 'trash'; 4169 let noticeMessage; 4170 let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false; 4171 let isDraft; 4172 4173 // Always should a notice, which will be spoken for accessibility. 4174 if (willTrash) { 4175 noticeMessage = postType.labels.item_trashed; 4176 shouldShowLink = false; 4177 } else if (!isPublished && !willPublish) { 4178 // If saving a non-published post, don't show notice. 4179 noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.'); 4180 isDraft = true; 4181 } else if (isPublished && !willPublish) { 4182 // If undoing publish status, show specific notice. 4183 noticeMessage = postType.labels.item_reverted_to_draft; 4184 shouldShowLink = false; 4185 } else if (!isPublished && willPublish) { 4186 // If publishing or scheduling a post, show the corresponding 4187 // publish message. 4188 noticeMessage = { 4189 publish: postType.labels.item_published, 4190 private: postType.labels.item_published_privately, 4191 future: postType.labels.item_scheduled 4192 }[post.status]; 4193 } else { 4194 // Generic fallback notice. 4195 noticeMessage = postType.labels.item_updated; 4196 } 4197 const actions = []; 4198 if (shouldShowLink) { 4199 actions.push({ 4200 label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item, 4201 url: post.link 4202 }); 4203 } 4204 return [noticeMessage, { 4205 id: SAVE_POST_NOTICE_ID, 4206 type: 'snackbar', 4207 actions 4208 }]; 4209 } 4210 4211 /** 4212 * Builds the fail notification arguments for dispatch. 4213 * 4214 * @param {Object} data Incoming data to build the arguments with. 4215 * 4216 * @return {Array} Arguments for dispatch. An empty array signals no 4217 * notification should be sent. 4218 */ 4219 function getNotificationArgumentsForSaveFail(data) { 4220 const { 4221 post, 4222 edits, 4223 error 4224 } = data; 4225 if (error && 'rest_autosave_no_changes' === error.code) { 4226 // Autosave requested a new autosave, but there were no changes. This shouldn't 4227 // result in an error notice for the user. 4228 return []; 4229 } 4230 const publishStatus = ['publish', 'private', 'future']; 4231 const isPublished = publishStatus.indexOf(post.status) !== -1; 4232 // If the post was being published, we show the corresponding publish error message 4233 // Unless we publish an "updating failed" message. 4234 const messages = { 4235 publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 4236 private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 4237 future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.') 4238 }; 4239 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); 4240 4241 // Check if message string contains HTML. Notice text is currently only 4242 // supported as plaintext, and stripping the tags may muddle the meaning. 4243 if (error.message && !/<\/?[^>]*>/.test(error.message)) { 4244 noticeMessage = [noticeMessage, error.message].join(' '); 4245 } 4246 return [noticeMessage, { 4247 id: SAVE_POST_NOTICE_ID 4248 }]; 4249 } 4250 4251 /** 4252 * Builds the trash fail notification arguments for dispatch. 4253 * 4254 * @param {Object} data 4255 * 4256 * @return {Array} Arguments for dispatch. 4257 */ 4258 function getNotificationArgumentsForTrashFail(data) { 4259 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), { 4260 id: TRASH_POST_NOTICE_ID 4261 }]; 4262 } 4263 4264 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js 4265 /** 4266 * WordPress dependencies 4267 */ 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 /** 4280 * Internal dependencies 4281 */ 4282 4283 4284 4285 4286 /** 4287 * Returns an action generator used in signalling that editor has initialized with 4288 * the specified post object and editor settings. 4289 * 4290 * @param {Object} post Post object. 4291 * @param {Object} edits Initial edited attributes object. 4292 * @param {Array?} template Block Template. 4293 */ 4294 const setupEditor = (post, edits, template) => ({ 4295 dispatch 4296 }) => { 4297 dispatch.setEditedPost(post.type, post.id); 4298 // Apply a template for new posts only, if exists. 4299 const isNewPost = post.status === 'auto-draft'; 4300 if (isNewPost && template) { 4301 // In order to ensure maximum of a single parse during setup, edits are 4302 // included as part of editor setup action. Assume edited content as 4303 // canonical if provided, falling back to post. 4304 let content; 4305 if ('content' in edits) { 4306 content = edits.content; 4307 } else { 4308 content = post.content.raw; 4309 } 4310 let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); 4311 blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); 4312 dispatch.resetEditorBlocks(blocks, { 4313 __unstableShouldCreateUndoLevel: false 4314 }); 4315 } 4316 if (edits && Object.values(edits).some(([key, edit]) => { 4317 var _post$key$raw; 4318 return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]); 4319 })) { 4320 dispatch.editPost(edits); 4321 } 4322 }; 4323 4324 /** 4325 * Returns an action object signalling that the editor is being destroyed and 4326 * that any necessary state or side-effect cleanup should occur. 4327 * 4328 * @deprecated 4329 * 4330 * @return {Object} Action object. 4331 */ 4332 function __experimentalTearDownEditor() { 4333 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", { 4334 since: '6.5' 4335 }); 4336 return { 4337 type: 'DO_NOTHING' 4338 }; 4339 } 4340 4341 /** 4342 * Returns an action object used in signalling that the latest version of the 4343 * post has been received, either by initialization or save. 4344 * 4345 * @deprecated Since WordPress 6.0. 4346 */ 4347 function resetPost() { 4348 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { 4349 since: '6.0', 4350 version: '6.3', 4351 alternative: 'Initialize the editor with the setupEditorState action' 4352 }); 4353 return { 4354 type: 'DO_NOTHING' 4355 }; 4356 } 4357 4358 /** 4359 * Returns an action object used in signalling that a patch of updates for the 4360 * latest version of the post have been received. 4361 * 4362 * @return {Object} Action object. 4363 * @deprecated since Gutenberg 9.7.0. 4364 */ 4365 function updatePost() { 4366 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { 4367 since: '5.7', 4368 alternative: 'Use the core entities store instead' 4369 }); 4370 return { 4371 type: 'DO_NOTHING' 4372 }; 4373 } 4374 4375 /** 4376 * Setup the editor state. 4377 * 4378 * @deprecated 4379 * 4380 * @param {Object} post Post object. 4381 */ 4382 function setupEditorState(post) { 4383 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", { 4384 since: '6.5', 4385 alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost" 4386 }); 4387 return setEditedPost(post.type, post.id); 4388 } 4389 4390 /** 4391 * Returns an action that sets the current post Type and post ID. 4392 * 4393 * @param {string} postType Post Type. 4394 * @param {string} postId Post ID. 4395 * 4396 * @return {Object} Action object. 4397 */ 4398 function setEditedPost(postType, postId) { 4399 return { 4400 type: 'SET_EDITED_POST', 4401 postType, 4402 postId 4403 }; 4404 } 4405 4406 /** 4407 * Returns an action object used in signalling that attributes of the post have 4408 * been edited. 4409 * 4410 * @param {Object} edits Post attributes to edit. 4411 * @param {Object} options Options for the edit. 4412 */ 4413 const editPost = (edits, options) => ({ 4414 select, 4415 registry 4416 }) => { 4417 const { 4418 id, 4419 type 4420 } = select.getCurrentPost(); 4421 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options); 4422 }; 4423 4424 /** 4425 * Action for saving the current post in the editor. 4426 * 4427 * @param {Object} options 4428 */ 4429 const savePost = (options = {}) => async ({ 4430 select, 4431 dispatch, 4432 registry 4433 }) => { 4434 if (!select.isEditedPostSaveable()) { 4435 return; 4436 } 4437 const content = select.getEditedPostContent(); 4438 if (!options.isAutosave) { 4439 dispatch.editPost({ 4440 content 4441 }, { 4442 undoIgnore: true 4443 }); 4444 } 4445 const previousRecord = select.getCurrentPost(); 4446 const edits = { 4447 id: previousRecord.id, 4448 ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id), 4449 content 4450 }; 4451 dispatch({ 4452 type: 'REQUEST_POST_UPDATE_START', 4453 options 4454 }); 4455 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options); 4456 let error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id); 4457 if (!error) { 4458 await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options).catch(err => { 4459 error = err; 4460 }); 4461 } 4462 dispatch({ 4463 type: 'REQUEST_POST_UPDATE_FINISH', 4464 options 4465 }); 4466 if (error) { 4467 const args = getNotificationArgumentsForSaveFail({ 4468 post: previousRecord, 4469 edits, 4470 error 4471 }); 4472 if (args.length) { 4473 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); 4474 } 4475 } else { 4476 const updatedRecord = select.getCurrentPost(); 4477 const args = getNotificationArgumentsForSaveSuccess({ 4478 previousPost: previousRecord, 4479 post: updatedRecord, 4480 postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), 4481 options 4482 }); 4483 if (args.length) { 4484 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); 4485 } 4486 // Make sure that any edits after saving create an undo level and are 4487 // considered for change detection. 4488 if (!options.isAutosave) { 4489 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 4490 } 4491 } 4492 }; 4493 4494 /** 4495 * Action for refreshing the current post. 4496 * 4497 * @deprecated Since WordPress 6.0. 4498 */ 4499 function refreshPost() { 4500 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { 4501 since: '6.0', 4502 version: '6.3', 4503 alternative: 'Use the core entities store instead' 4504 }); 4505 return { 4506 type: 'DO_NOTHING' 4507 }; 4508 } 4509 4510 /** 4511 * Action for trashing the current post in the editor. 4512 */ 4513 const trashPost = () => async ({ 4514 select, 4515 dispatch, 4516 registry 4517 }) => { 4518 const postTypeSlug = select.getCurrentPostType(); 4519 const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 4520 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID); 4521 const { 4522 rest_base: restBase, 4523 rest_namespace: restNamespace = 'wp/v2' 4524 } = postType; 4525 dispatch({ 4526 type: 'REQUEST_POST_DELETE_START' 4527 }); 4528 try { 4529 const post = select.getCurrentPost(); 4530 await external_wp_apiFetch_default()({ 4531 path: `/$restNamespace}/$restBase}/$post.id}`, 4532 method: 'DELETE' 4533 }); 4534 await dispatch.savePost(); 4535 } catch (error) { 4536 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({ 4537 error 4538 })); 4539 } 4540 dispatch({ 4541 type: 'REQUEST_POST_DELETE_FINISH' 4542 }); 4543 }; 4544 4545 /** 4546 * Action that autosaves the current post. This 4547 * includes server-side autosaving (default) and client-side (a.k.a. local) 4548 * autosaving (e.g. on the Web, the post might be committed to Session 4549 * Storage). 4550 * 4551 * @param {Object?} options Extra flags to identify the autosave. 4552 */ 4553 const autosave = ({ 4554 local = false, 4555 ...options 4556 } = {}) => async ({ 4557 select, 4558 dispatch 4559 }) => { 4560 const post = select.getCurrentPost(); 4561 4562 // Currently template autosaving is not supported. 4563 if (post.type === 'wp_template') { 4564 return; 4565 } 4566 if (local) { 4567 const isPostNew = select.isEditedPostNew(); 4568 const title = select.getEditedPostAttribute('title'); 4569 const content = select.getEditedPostAttribute('content'); 4570 const excerpt = select.getEditedPostAttribute('excerpt'); 4571 localAutosaveSet(post.id, isPostNew, title, content, excerpt); 4572 } else { 4573 await dispatch.savePost({ 4574 isAutosave: true, 4575 ...options 4576 }); 4577 } 4578 }; 4579 const __unstableSaveForPreview = ({ 4580 forceIsAutosaveable 4581 } = {}) => async ({ 4582 select, 4583 dispatch 4584 }) => { 4585 if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) { 4586 const isDraft = ['draft', 'auto-draft'].includes(select.getEditedPostAttribute('status')); 4587 if (isDraft) { 4588 await dispatch.savePost({ 4589 isPreview: true 4590 }); 4591 } else { 4592 await dispatch.autosave({ 4593 isPreview: true 4594 }); 4595 } 4596 } 4597 return select.getEditedPostPreviewLink(); 4598 }; 4599 4600 /** 4601 * Action that restores last popped state in undo history. 4602 */ 4603 const redo = () => ({ 4604 registry 4605 }) => { 4606 registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); 4607 }; 4608 4609 /** 4610 * Action that pops a record from undo history and undoes the edit. 4611 */ 4612 const undo = () => ({ 4613 registry 4614 }) => { 4615 registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); 4616 }; 4617 4618 /** 4619 * Action that creates an undo history record. 4620 * 4621 * @deprecated Since WordPress 6.0 4622 */ 4623 function createUndoLevel() { 4624 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { 4625 since: '6.0', 4626 version: '6.3', 4627 alternative: 'Use the core entities store instead' 4628 }); 4629 return { 4630 type: 'DO_NOTHING' 4631 }; 4632 } 4633 4634 /** 4635 * Action that locks the editor. 4636 * 4637 * @param {Object} lock Details about the post lock status, user, and nonce. 4638 * @return {Object} Action object. 4639 */ 4640 function updatePostLock(lock) { 4641 return { 4642 type: 'UPDATE_POST_LOCK', 4643 lock 4644 }; 4645 } 4646 4647 /** 4648 * Enable the publish sidebar. 4649 */ 4650 const enablePublishSidebar = () => ({ 4651 registry 4652 }) => { 4653 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', true); 4654 }; 4655 4656 /** 4657 * Disables the publish sidebar. 4658 */ 4659 const disablePublishSidebar = () => ({ 4660 registry 4661 }) => { 4662 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', false); 4663 }; 4664 4665 /** 4666 * Action that locks post saving. 4667 * 4668 * @param {string} lockName The lock name. 4669 * 4670 * @example 4671 * ``` 4672 * const { subscribe } = wp.data; 4673 * 4674 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 4675 * 4676 * // Only allow publishing posts that are set to a future date. 4677 * if ( 'publish' !== initialPostStatus ) { 4678 * 4679 * // Track locking. 4680 * let locked = false; 4681 * 4682 * // Watch for the publish event. 4683 * let unssubscribe = subscribe( () => { 4684 * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 4685 * if ( 'publish' !== currentPostStatus ) { 4686 * 4687 * // Compare the post date to the current date, lock the post if the date isn't in the future. 4688 * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); 4689 * const currentDate = new Date(); 4690 * if ( postDate.getTime() <= currentDate.getTime() ) { 4691 * if ( ! locked ) { 4692 * locked = true; 4693 * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); 4694 * } 4695 * } else { 4696 * if ( locked ) { 4697 * locked = false; 4698 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); 4699 * } 4700 * } 4701 * } 4702 * } ); 4703 * } 4704 * ``` 4705 * 4706 * @return {Object} Action object 4707 */ 4708 function lockPostSaving(lockName) { 4709 return { 4710 type: 'LOCK_POST_SAVING', 4711 lockName 4712 }; 4713 } 4714 4715 /** 4716 * Action that unlocks post saving. 4717 * 4718 * @param {string} lockName The lock name. 4719 * 4720 * @example 4721 * ``` 4722 * // Unlock post saving with the lock key `mylock`: 4723 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); 4724 * ``` 4725 * 4726 * @return {Object} Action object 4727 */ 4728 function unlockPostSaving(lockName) { 4729 return { 4730 type: 'UNLOCK_POST_SAVING', 4731 lockName 4732 }; 4733 } 4734 4735 /** 4736 * Action that locks post autosaving. 4737 * 4738 * @param {string} lockName The lock name. 4739 * 4740 * @example 4741 * ``` 4742 * // Lock post autosaving with the lock key `mylock`: 4743 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); 4744 * ``` 4745 * 4746 * @return {Object} Action object 4747 */ 4748 function lockPostAutosaving(lockName) { 4749 return { 4750 type: 'LOCK_POST_AUTOSAVING', 4751 lockName 4752 }; 4753 } 4754 4755 /** 4756 * Action that unlocks post autosaving. 4757 * 4758 * @param {string} lockName The lock name. 4759 * 4760 * @example 4761 * ``` 4762 * // Unlock post saving with the lock key `mylock`: 4763 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); 4764 * ``` 4765 * 4766 * @return {Object} Action object 4767 */ 4768 function unlockPostAutosaving(lockName) { 4769 return { 4770 type: 'UNLOCK_POST_AUTOSAVING', 4771 lockName 4772 }; 4773 } 4774 4775 /** 4776 * Returns an action object used to signal that the blocks have been updated. 4777 * 4778 * @param {Array} blocks Block Array. 4779 * @param {?Object} options Optional options. 4780 */ 4781 const resetEditorBlocks = (blocks, options = {}) => ({ 4782 select, 4783 dispatch, 4784 registry 4785 }) => { 4786 const { 4787 __unstableShouldCreateUndoLevel, 4788 selection 4789 } = options; 4790 const edits = { 4791 blocks, 4792 selection 4793 }; 4794 if (__unstableShouldCreateUndoLevel !== false) { 4795 const { 4796 id, 4797 type 4798 } = select.getCurrentPost(); 4799 const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks; 4800 if (noChange) { 4801 registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id); 4802 return; 4803 } 4804 4805 // We create a new function here on every persistent edit 4806 // to make sure the edit makes the post dirty and creates 4807 // a new undo level. 4808 edits.content = ({ 4809 blocks: blocksForSerialization = [] 4810 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 4811 } 4812 dispatch.editPost(edits); 4813 }; 4814 4815 /* 4816 * Returns an action object used in signalling that the post editor settings have been updated. 4817 * 4818 * @param {Object} settings Updated settings 4819 * 4820 * @return {Object} Action object 4821 */ 4822 function updateEditorSettings(settings) { 4823 return { 4824 type: 'UPDATE_EDITOR_SETTINGS', 4825 settings 4826 }; 4827 } 4828 4829 /** 4830 * Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes: 4831 * 4832 * - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template. 4833 * - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable. 4834 * 4835 * @param {string} mode Mode (one of 'post-only' or 'template-locked'). 4836 */ 4837 const setRenderingMode = mode => ({ 4838 dispatch, 4839 registry, 4840 select 4841 }) => { 4842 if (select.__unstableIsEditorReady()) { 4843 // We clear the block selection but we also need to clear the selection from the core store. 4844 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 4845 dispatch.editPost({ 4846 selection: undefined 4847 }, { 4848 undoIgnore: true 4849 }); 4850 } 4851 dispatch({ 4852 type: 'SET_RENDERING_MODE', 4853 mode 4854 }); 4855 }; 4856 4857 /** 4858 * Action that changes the width of the editing canvas. 4859 * 4860 * @param {string} deviceType 4861 * 4862 * @return {Object} Action object. 4863 */ 4864 function setDeviceType(deviceType) { 4865 return { 4866 type: 'SET_DEVICE_TYPE', 4867 deviceType 4868 }; 4869 } 4870 4871 /** 4872 * Returns an action object used to enable or disable a panel in the editor. 4873 * 4874 * @param {string} panelName A string that identifies the panel to enable or disable. 4875 * 4876 * @return {Object} Action object. 4877 */ 4878 const toggleEditorPanelEnabled = panelName => ({ 4879 registry 4880 }) => { 4881 var _registry$select$get; 4882 const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; 4883 const isPanelInactive = !!inactivePanels?.includes(panelName); 4884 4885 // If the panel is inactive, remove it to enable it, else add it to 4886 // make it inactive. 4887 let updatedInactivePanels; 4888 if (isPanelInactive) { 4889 updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName); 4890 } else { 4891 updatedInactivePanels = [...inactivePanels, panelName]; 4892 } 4893 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'inactivePanels', updatedInactivePanels); 4894 }; 4895 4896 /** 4897 * Opens a closed panel and closes an open panel. 4898 * 4899 * @param {string} panelName A string that identifies the panel to open or close. 4900 */ 4901 const toggleEditorPanelOpened = panelName => ({ 4902 registry 4903 }) => { 4904 var _registry$select$get2; 4905 const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; 4906 const isPanelOpen = !!openPanels?.includes(panelName); 4907 4908 // If the panel is open, remove it to close it, else add it to 4909 // make it open. 4910 let updatedOpenPanels; 4911 if (isPanelOpen) { 4912 updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName); 4913 } else { 4914 updatedOpenPanels = [...openPanels, panelName]; 4915 } 4916 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'openPanels', updatedOpenPanels); 4917 }; 4918 4919 /** 4920 * Returns an action object used to remove a panel from the editor. 4921 * 4922 * @param {string} panelName A string that identifies the panel to remove. 4923 * 4924 * @return {Object} Action object. 4925 */ 4926 function removeEditorPanel(panelName) { 4927 return { 4928 type: 'REMOVE_PANEL', 4929 panelName 4930 }; 4931 } 4932 4933 /** 4934 * Returns an action object used to open/close the inserter. 4935 * 4936 * @param {boolean|Object} value Whether the inserter should be 4937 * opened (true) or closed (false). 4938 * To specify an insertion point, 4939 * use an object. 4940 * @param {string} value.rootClientId The root client ID to insert at. 4941 * @param {number} value.insertionIndex The index to insert at. 4942 * 4943 * @return {Object} Action object. 4944 */ 4945 function setIsInserterOpened(value) { 4946 return { 4947 type: 'SET_IS_INSERTER_OPENED', 4948 value 4949 }; 4950 } 4951 4952 /** 4953 * Returns an action object used to open/close the list view. 4954 * 4955 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 4956 * @return {Object} Action object. 4957 */ 4958 function setIsListViewOpened(isOpen) { 4959 return { 4960 type: 'SET_IS_LIST_VIEW_OPENED', 4961 isOpen 4962 }; 4963 } 4964 4965 /** 4966 * Action that toggles Distraction free mode. 4967 * Distraction free mode expects there are no sidebars, as due to the 4968 * z-index values set, you can't close sidebars. 4969 */ 4970 const toggleDistractionFree = () => ({ 4971 dispatch, 4972 registry 4973 }) => { 4974 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 4975 if (isDistractionFree) { 4976 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false); 4977 } 4978 if (!isDistractionFree) { 4979 registry.batch(() => { 4980 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true); 4981 dispatch.setIsInserterOpened(false); 4982 dispatch.setIsListViewOpened(false); 4983 }); 4984 } 4985 registry.batch(() => { 4986 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree); 4987 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), { 4988 id: 'core/editor/distraction-free-mode/notice', 4989 type: 'snackbar', 4990 actions: [{ 4991 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 4992 onClick: () => { 4993 registry.batch(() => { 4994 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false); 4995 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree'); 4996 }); 4997 } 4998 }] 4999 }); 5000 }); 5001 }; 5002 5003 /** 5004 * Triggers an action used to switch editor mode. 5005 * 5006 * @param {string} mode The editor mode. 5007 */ 5008 const switchEditorMode = mode => ({ 5009 dispatch, 5010 registry 5011 }) => { 5012 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode); 5013 5014 // Unselect blocks when we switch to a non visual mode. 5015 if (mode !== 'visual') { 5016 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 5017 } 5018 if (mode === 'visual') { 5019 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive'); 5020 } else if (mode === 'text') { 5021 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 5022 if (isDistractionFree) { 5023 dispatch.toggleDistractionFree(); 5024 } 5025 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive'); 5026 } 5027 }; 5028 5029 /** 5030 * Returns an action object used in signalling that the user opened the publish 5031 * sidebar. 5032 * 5033 * @return {Object} Action object 5034 */ 5035 function openPublishSidebar() { 5036 return { 5037 type: 'OPEN_PUBLISH_SIDEBAR' 5038 }; 5039 } 5040 5041 /** 5042 * Returns an action object used in signalling that the user closed the 5043 * publish sidebar. 5044 * 5045 * @return {Object} Action object. 5046 */ 5047 function closePublishSidebar() { 5048 return { 5049 type: 'CLOSE_PUBLISH_SIDEBAR' 5050 }; 5051 } 5052 5053 /** 5054 * Returns an action object used in signalling that the user toggles the publish sidebar. 5055 * 5056 * @return {Object} Action object 5057 */ 5058 function togglePublishSidebar() { 5059 return { 5060 type: 'TOGGLE_PUBLISH_SIDEBAR' 5061 }; 5062 } 5063 5064 /** 5065 * Backward compatibility 5066 */ 5067 5068 const getBlockEditorAction = name => (...args) => ({ 5069 registry 5070 }) => { 5071 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { 5072 since: '5.3', 5073 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`', 5074 version: '6.2' 5075 }); 5076 registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); 5077 }; 5078 5079 /** 5080 * @see resetBlocks in core/block-editor store. 5081 */ 5082 const resetBlocks = getBlockEditorAction('resetBlocks'); 5083 5084 /** 5085 * @see receiveBlocks in core/block-editor store. 5086 */ 5087 const receiveBlocks = getBlockEditorAction('receiveBlocks'); 5088 5089 /** 5090 * @see updateBlock in core/block-editor store. 5091 */ 5092 const updateBlock = getBlockEditorAction('updateBlock'); 5093 5094 /** 5095 * @see updateBlockAttributes in core/block-editor store. 5096 */ 5097 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); 5098 5099 /** 5100 * @see selectBlock in core/block-editor store. 5101 */ 5102 const selectBlock = getBlockEditorAction('selectBlock'); 5103 5104 /** 5105 * @see startMultiSelect in core/block-editor store. 5106 */ 5107 const startMultiSelect = getBlockEditorAction('startMultiSelect'); 5108 5109 /** 5110 * @see stopMultiSelect in core/block-editor store. 5111 */ 5112 const stopMultiSelect = getBlockEditorAction('stopMultiSelect'); 5113 5114 /** 5115 * @see multiSelect in core/block-editor store. 5116 */ 5117 const multiSelect = getBlockEditorAction('multiSelect'); 5118 5119 /** 5120 * @see clearSelectedBlock in core/block-editor store. 5121 */ 5122 const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); 5123 5124 /** 5125 * @see toggleSelection in core/block-editor store. 5126 */ 5127 const toggleSelection = getBlockEditorAction('toggleSelection'); 5128 5129 /** 5130 * @see replaceBlocks in core/block-editor store. 5131 */ 5132 const replaceBlocks = getBlockEditorAction('replaceBlocks'); 5133 5134 /** 5135 * @see replaceBlock in core/block-editor store. 5136 */ 5137 const replaceBlock = getBlockEditorAction('replaceBlock'); 5138 5139 /** 5140 * @see moveBlocksDown in core/block-editor store. 5141 */ 5142 const moveBlocksDown = getBlockEditorAction('moveBlocksDown'); 5143 5144 /** 5145 * @see moveBlocksUp in core/block-editor store. 5146 */ 5147 const moveBlocksUp = getBlockEditorAction('moveBlocksUp'); 5148 5149 /** 5150 * @see moveBlockToPosition in core/block-editor store. 5151 */ 5152 const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition'); 5153 5154 /** 5155 * @see insertBlock in core/block-editor store. 5156 */ 5157 const insertBlock = getBlockEditorAction('insertBlock'); 5158 5159 /** 5160 * @see insertBlocks in core/block-editor store. 5161 */ 5162 const insertBlocks = getBlockEditorAction('insertBlocks'); 5163 5164 /** 5165 * @see showInsertionPoint in core/block-editor store. 5166 */ 5167 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); 5168 5169 /** 5170 * @see hideInsertionPoint in core/block-editor store. 5171 */ 5172 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); 5173 5174 /** 5175 * @see setTemplateValidity in core/block-editor store. 5176 */ 5177 const setTemplateValidity = getBlockEditorAction('setTemplateValidity'); 5178 5179 /** 5180 * @see synchronizeTemplate in core/block-editor store. 5181 */ 5182 const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); 5183 5184 /** 5185 * @see mergeBlocks in core/block-editor store. 5186 */ 5187 const mergeBlocks = getBlockEditorAction('mergeBlocks'); 5188 5189 /** 5190 * @see removeBlocks in core/block-editor store. 5191 */ 5192 const removeBlocks = getBlockEditorAction('removeBlocks'); 5193 5194 /** 5195 * @see removeBlock in core/block-editor store. 5196 */ 5197 const removeBlock = getBlockEditorAction('removeBlock'); 5198 5199 /** 5200 * @see toggleBlockMode in core/block-editor store. 5201 */ 5202 const toggleBlockMode = getBlockEditorAction('toggleBlockMode'); 5203 5204 /** 5205 * @see startTyping in core/block-editor store. 5206 */ 5207 const startTyping = getBlockEditorAction('startTyping'); 5208 5209 /** 5210 * @see stopTyping in core/block-editor store. 5211 */ 5212 const stopTyping = getBlockEditorAction('stopTyping'); 5213 5214 /** 5215 * @see enterFormattedText in core/block-editor store. 5216 */ 5217 const enterFormattedText = getBlockEditorAction('enterFormattedText'); 5218 5219 /** 5220 * @see exitFormattedText in core/block-editor store. 5221 */ 5222 const exitFormattedText = getBlockEditorAction('exitFormattedText'); 5223 5224 /** 5225 * @see insertDefaultBlock in core/block-editor store. 5226 */ 5227 const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); 5228 5229 /** 5230 * @see updateBlockListSettings in core/block-editor store. 5231 */ 5232 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); 5233 5234 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] 5235 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 5236 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js 5237 /** 5238 * Internal dependencies 5239 */ 5240 5241 5242 // Copy of the function from packages/edit-site/src/utils/is-template-revertable.js 5243 5244 /** 5245 * Check if a template or template part is revertable to its original theme-provided file. 5246 * 5247 * @param {Object} templateOrTemplatePart The entity to check. 5248 * @return {boolean} Whether the entity is revertable. 5249 */ 5250 function isTemplateRevertable(templateOrTemplatePart) { 5251 if (!templateOrTemplatePart) { 5252 return false; 5253 } 5254 return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && templateOrTemplatePart.has_theme_file; 5255 } 5256 5257 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/private-actions.js 5258 /** 5259 * WordPress dependencies 5260 */ 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 /** 5272 * Internal dependencies 5273 */ 5274 5275 5276 /** 5277 * Returns an action object used to set which template is currently being used/edited. 5278 * 5279 * @param {string} id Template Id. 5280 * 5281 * @return {Object} Action object. 5282 */ 5283 function setCurrentTemplateId(id) { 5284 return { 5285 type: 'SET_CURRENT_TEMPLATE_ID', 5286 id 5287 }; 5288 } 5289 5290 /** 5291 * Create a block based template. 5292 * 5293 * @param {Object?} template Template to create and assign. 5294 */ 5295 const createTemplate = template => async ({ 5296 select, 5297 dispatch, 5298 registry 5299 }) => { 5300 const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); 5301 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', select.getCurrentPostType(), select.getCurrentPostId(), { 5302 template: savedTemplate.slug 5303 }); 5304 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), { 5305 type: 'snackbar', 5306 actions: [{ 5307 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 5308 onClick: () => dispatch.setRenderingMode(select.getEditorSettings().defaultRenderingMode) 5309 }] 5310 }); 5311 return savedTemplate; 5312 }; 5313 5314 /** 5315 * Update the provided block types to be visible. 5316 * 5317 * @param {string[]} blockNames Names of block types to show. 5318 */ 5319 const showBlockTypes = blockNames => ({ 5320 registry 5321 }) => { 5322 var _registry$select$get; 5323 const existingBlockNames = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; 5324 const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type)); 5325 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', newBlockNames); 5326 }; 5327 5328 /** 5329 * Update the provided block types to be hidden. 5330 * 5331 * @param {string[]} blockNames Names of block types to hide. 5332 */ 5333 const hideBlockTypes = blockNames => ({ 5334 registry 5335 }) => { 5336 var _registry$select$get2; 5337 const existingBlockNames = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; 5338 const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]); 5339 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]); 5340 }; 5341 5342 /** 5343 * Save entity records marked as dirty. 5344 * 5345 * @param {Object} options Options for the action. 5346 * @param {Function} [options.onSave] Callback when saving happens. 5347 * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities. 5348 * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving. 5349 * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`. 5350 */ 5351 const saveDirtyEntities = ({ 5352 onSave, 5353 dirtyEntityRecords = [], 5354 entitiesToSkip = [], 5355 close 5356 } = {}) => ({ 5357 registry 5358 }) => { 5359 const PUBLISH_ON_SAVE_ENTITIES = [{ 5360 kind: 'postType', 5361 name: 'wp_navigation' 5362 }]; 5363 const saveNoticeId = 'site-editor-save-success'; 5364 const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getUnstableBase()?.home; 5365 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId); 5366 const entitiesToSave = dirtyEntityRecords.filter(({ 5367 kind, 5368 name, 5369 key, 5370 property 5371 }) => { 5372 return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); 5373 }); 5374 close?.(entitiesToSave); 5375 const siteItemsToSave = []; 5376 const pendingSavedRecords = []; 5377 entitiesToSave.forEach(({ 5378 kind, 5379 name, 5380 key, 5381 property 5382 }) => { 5383 if ('root' === kind && 'site' === name) { 5384 siteItemsToSave.push(property); 5385 } else { 5386 if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) { 5387 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, { 5388 status: 'publish' 5389 }); 5390 } 5391 pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key)); 5392 } 5393 }); 5394 if (siteItemsToSave.length) { 5395 pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave)); 5396 } 5397 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 5398 Promise.all(pendingSavedRecords).then(values => { 5399 return onSave ? onSave(values) : values; 5400 }).then(values => { 5401 if (values.some(value => typeof value === 'undefined')) { 5402 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.')); 5403 } else { 5404 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), { 5405 type: 'snackbar', 5406 id: saveNoticeId, 5407 actions: [{ 5408 label: (0,external_wp_i18n_namespaceObject.__)('View site'), 5409 url: homeUrl 5410 }] 5411 }); 5412 } 5413 }).catch(error => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} $error}`)); 5414 }; 5415 5416 /** 5417 * Reverts a template to its original theme-provided file. 5418 * 5419 * @param {Object} template The template to revert. 5420 * @param {Object} [options] 5421 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 5422 * reverting the template. Default true. 5423 */ 5424 const revertTemplate = (template, { 5425 allowUndo = true 5426 } = {}) => async ({ 5427 registry 5428 }) => { 5429 const noticeId = 'edit-site-template-reverted'; 5430 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId); 5431 if (!isTemplateRevertable(template)) { 5432 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { 5433 type: 'snackbar' 5434 }); 5435 return; 5436 } 5437 try { 5438 const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); 5439 if (!templateEntityConfig) { 5440 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 5441 type: 'snackbar' 5442 }); 5443 return; 5444 } 5445 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`$templateEntityConfig.baseURL}/$template.id}`, { 5446 context: 'edit', 5447 source: 'theme' 5448 }); 5449 const fileTemplate = await external_wp_apiFetch_default()({ 5450 path: fileTemplatePath 5451 }); 5452 if (!fileTemplate) { 5453 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 5454 type: 'snackbar' 5455 }); 5456 return; 5457 } 5458 const serializeBlocks = ({ 5459 blocks: blocksForSerialization = [] 5460 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 5461 const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); 5462 5463 // We are fixing up the undo level here to make sure we can undo 5464 // the revert in the header toolbar correctly. 5465 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { 5466 content: serializeBlocks, 5467 // Required to make the `undo` behave correctly. 5468 blocks: edited.blocks, 5469 // Required to revert the blocks in the editor. 5470 source: 'custom' // required to avoid turning the editor into a dirty state 5471 }, { 5472 undoIgnore: true // Required to merge this edit with the last undo level. 5473 }); 5474 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); 5475 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { 5476 content: serializeBlocks, 5477 blocks, 5478 source: 'theme' 5479 }); 5480 if (allowUndo) { 5481 const undoRevert = () => { 5482 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { 5483 content: serializeBlocks, 5484 blocks: edited.blocks, 5485 source: 'custom' 5486 }); 5487 }; 5488 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), { 5489 type: 'snackbar', 5490 id: noticeId, 5491 actions: [{ 5492 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 5493 onClick: undoRevert 5494 }] 5495 }); 5496 } 5497 } catch (error) { 5498 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); 5499 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 5500 type: 'snackbar' 5501 }); 5502 } 5503 }; 5504 5505 /** 5506 * Action that removes an array of templates, template parts or patterns. 5507 * 5508 * @param {Array} items An array of template,template part or pattern objects to remove. 5509 */ 5510 const removeTemplates = items => async ({ 5511 registry 5512 }) => { 5513 const isResetting = items.every(item => !!item && (item.has_theme_file || item.templatePart && item.templatePart.has_theme_file)); 5514 const promiseResult = await Promise.allSettled(items.map(item => { 5515 return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, { 5516 force: true 5517 }, { 5518 throwOnError: true 5519 }); 5520 })); 5521 5522 // If all the promises were fulfilled with sucess. 5523 if (promiseResult.every(({ 5524 status 5525 }) => status === 'fulfilled')) { 5526 let successMessage; 5527 if (items.length === 1) { 5528 // Depending on how the entity was retrieved its title might be 5529 // an object or simple string. 5530 const title = typeof items[0].title === 'string' ? items[0].title : items[0].title?.rendered; 5531 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */ 5532 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */ 5533 (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); 5534 } else { 5535 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.'); 5536 } 5537 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, { 5538 type: 'snackbar', 5539 id: 'editor-template-deleted-success' 5540 }); 5541 } else { 5542 // If there was at lease one failure. 5543 let errorMessage; 5544 // If we were trying to delete a single template. 5545 if (promiseResult.length === 1) { 5546 if (promiseResult[0].reason?.message) { 5547 errorMessage = promiseResult[0].reason.message; 5548 } else { 5549 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.'); 5550 } 5551 // If we were trying to delete a multiple templates 5552 } else { 5553 const errorMessages = new Set(); 5554 const failedPromises = promiseResult.filter(({ 5555 status 5556 }) => status === 'rejected'); 5557 for (const failedPromise of failedPromises) { 5558 if (failedPromise.reason?.message) { 5559 errorMessages.add(failedPromise.reason.message); 5560 } 5561 } 5562 if (errorMessages.size === 0) { 5563 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.'); 5564 } else if (errorMessages.size === 1) { 5565 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ 5566 (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errorMessages][0]) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ 5567 (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errorMessages][0]); 5568 } else { 5569 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ 5570 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errorMessages].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ 5571 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errorMessages].join(',')); 5572 } 5573 } 5574 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 5575 type: 'snackbar' 5576 }); 5577 } 5578 }; 5579 5580 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js 5581 var fast_deep_equal = __webpack_require__(5215); 5582 var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); 5583 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js 5584 /** 5585 * WordPress dependencies 5586 */ 5587 5588 5589 const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 5590 xmlns: "http://www.w3.org/2000/svg", 5591 viewBox: "0 0 24 24", 5592 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5593 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-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 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" 5594 }) 5595 }); 5596 /* harmony default export */ const library_symbol = (symbol); 5597 5598 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js 5599 /** 5600 * WordPress dependencies 5601 */ 5602 5603 5604 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 5605 viewBox: "0 0 24 24", 5606 xmlns: "http://www.w3.org/2000/svg", 5607 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5608 d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" 5609 }) 5610 }); 5611 /* harmony default export */ const library_navigation = (navigation); 5612 5613 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js 5614 /** 5615 * WordPress dependencies 5616 */ 5617 5618 5619 5620 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 5621 xmlns: "http://www.w3.org/2000/svg", 5622 viewBox: "0 0 24 24", 5623 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5624 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 5625 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5626 d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" 5627 })] 5628 }); 5629 /* harmony default export */ const library_page = (page); 5630 5631 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js 5632 /** 5633 * WordPress dependencies 5634 */ 5635 5636 5637 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 5638 viewBox: "0 0 24 24", 5639 xmlns: "http://www.w3.org/2000/svg", 5640 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5641 d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" 5642 }) 5643 }); 5644 /* harmony default export */ const library_verse = (verse); 5645 5646 ;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js 5647 /** 5648 * Memize options object. 5649 * 5650 * @typedef MemizeOptions 5651 * 5652 * @property {number} [maxSize] Maximum size of the cache. 5653 */ 5654 5655 /** 5656 * Internal cache entry. 5657 * 5658 * @typedef MemizeCacheNode 5659 * 5660 * @property {?MemizeCacheNode|undefined} [prev] Previous node. 5661 * @property {?MemizeCacheNode|undefined} [next] Next node. 5662 * @property {Array<*>} args Function arguments for cache 5663 * entry. 5664 * @property {*} val Function result. 5665 */ 5666 5667 /** 5668 * Properties of the enhanced function for controlling cache. 5669 * 5670 * @typedef MemizeMemoizedFunction 5671 * 5672 * @property {()=>void} clear Clear the cache. 5673 */ 5674 5675 /** 5676 * Accepts a function to be memoized, and returns a new memoized function, with 5677 * optional options. 5678 * 5679 * @template {(...args: any[]) => any} F 5680 * 5681 * @param {F} fn Function to memoize. 5682 * @param {MemizeOptions} [options] Options object. 5683 * 5684 * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. 5685 */ 5686 function memize(fn, options) { 5687 var size = 0; 5688 5689 /** @type {?MemizeCacheNode|undefined} */ 5690 var head; 5691 5692 /** @type {?MemizeCacheNode|undefined} */ 5693 var tail; 5694 5695 options = options || {}; 5696 5697 function memoized(/* ...args */) { 5698 var node = head, 5699 len = arguments.length, 5700 args, 5701 i; 5702 5703 searchCache: while (node) { 5704 // Perform a shallow equality test to confirm that whether the node 5705 // under test is a candidate for the arguments passed. Two arrays 5706 // are shallowly equal if their length matches and each entry is 5707 // strictly equal between the two sets. Avoid abstracting to a 5708 // function which could incur an arguments leaking deoptimization. 5709 5710 // Check whether node arguments match arguments length 5711 if (node.args.length !== arguments.length) { 5712 node = node.next; 5713 continue; 5714 } 5715 5716 // Check whether node arguments match arguments values 5717 for (i = 0; i < len; i++) { 5718 if (node.args[i] !== arguments[i]) { 5719 node = node.next; 5720 continue searchCache; 5721 } 5722 } 5723 5724 // At this point we can assume we've found a match 5725 5726 // Surface matched node to head if not already 5727 if (node !== head) { 5728 // As tail, shift to previous. Must only shift if not also 5729 // head, since if both head and tail, there is no previous. 5730 if (node === tail) { 5731 tail = node.prev; 5732 } 5733 5734 // Adjust siblings to point to each other. If node was tail, 5735 // this also handles new tail's empty `next` assignment. 5736 /** @type {MemizeCacheNode} */ (node.prev).next = node.next; 5737 if (node.next) { 5738 node.next.prev = node.prev; 5739 } 5740 5741 node.next = head; 5742 node.prev = null; 5743 /** @type {MemizeCacheNode} */ (head).prev = node; 5744 head = node; 5745 } 5746 5747 // Return immediately 5748 return node.val; 5749 } 5750 5751 // No cached value found. Continue to insertion phase: 5752 5753 // Create a copy of arguments (avoid leaking deoptimization) 5754 args = new Array(len); 5755 for (i = 0; i < len; i++) { 5756 args[i] = arguments[i]; 5757 } 5758 5759 node = { 5760 args: args, 5761 5762 // Generate the result from original function 5763 val: fn.apply(null, args), 5764 }; 5765 5766 // Don't need to check whether node is already head, since it would 5767 // have been returned above already if it was 5768 5769 // Shift existing head down list 5770 if (head) { 5771 head.prev = node; 5772 node.next = head; 5773 } else { 5774 // If no head, follows that there's no tail (at initial or reset) 5775 tail = node; 5776 } 5777 5778 // Trim tail if we're reached max size and are pending cache insertion 5779 if (size === /** @type {MemizeOptions} */ (options).maxSize) { 5780 tail = /** @type {MemizeCacheNode} */ (tail).prev; 5781 /** @type {MemizeCacheNode} */ (tail).next = null; 5782 } else { 5783 size++; 5784 } 5785 5786 head = node; 5787 5788 return node.val; 5789 } 5790 5791 memoized.clear = function () { 5792 head = null; 5793 tail = null; 5794 size = 0; 5795 }; 5796 5797 // Ignore reason: There's not a clear solution to create an intersection of 5798 // the function with additional properties, where the goal is to retain the 5799 // function signature of the incoming argument and add control properties 5800 // on the return value. 5801 5802 // @ts-ignore 5803 return memoized; 5804 } 5805 5806 5807 5808 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/get-filtered-template-parts.js 5809 /** 5810 * External dependencies 5811 */ 5812 5813 5814 /** 5815 * WordPress dependencies 5816 */ 5817 5818 const EMPTY_ARRAY = []; 5819 5820 /** 5821 * Get a flattened and filtered list of template parts and the matching block for that template part. 5822 * 5823 * Takes a list of blocks defined within a template, and a list of template parts, and returns a 5824 * flattened list of template parts and the matching block for that template part. 5825 * 5826 * @param {Array} blocks Blocks to flatten. 5827 * @param {?Array} templateParts Available template parts. 5828 * @return {Array} An array of template parts and their blocks. 5829 */ 5830 function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { 5831 const templatePartsById = templateParts ? 5832 // Key template parts by their ID. 5833 templateParts.reduce((newTemplateParts, part) => ({ 5834 ...newTemplateParts, 5835 [part.id]: part 5836 }), {}) : {}; 5837 const result = []; 5838 5839 // Iterate over all blocks, recursing into inner blocks. 5840 // Output will be based on a depth-first traversal. 5841 const stack = [...blocks]; 5842 while (stack.length) { 5843 const { 5844 innerBlocks, 5845 ...block 5846 } = stack.shift(); 5847 // Place inner blocks at the beginning of the stack to preserve order. 5848 stack.unshift(...innerBlocks); 5849 if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { 5850 const { 5851 attributes: { 5852 theme, 5853 slug 5854 } 5855 } = block; 5856 const templatePartId = `$theme}//${slug}`; 5857 const templatePart = templatePartsById[templatePartId]; 5858 5859 // Only add to output if the found template part block is in the list of available template parts. 5860 if (templatePart) { 5861 result.push({ 5862 templatePart, 5863 block 5864 }); 5865 } 5866 } 5867 } 5868 return result; 5869 } 5870 const memoizedGetFilteredTemplatePartBlocks = memize(getFilteredTemplatePartBlocks); 5871 5872 5873 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 5874 /** 5875 * External dependencies 5876 */ 5877 5878 5879 /** 5880 * WordPress dependencies 5881 */ 5882 5883 5884 5885 5886 5887 /** 5888 * Internal dependencies 5889 */ 5890 5891 5892 5893 const EMPTY_INSERTION_POINT = { 5894 rootClientId: undefined, 5895 insertionIndex: undefined, 5896 filterValue: undefined 5897 }; 5898 5899 /** 5900 * Get the insertion point for the inserter. 5901 * 5902 * @param {Object} state Global application state. 5903 * 5904 * @return {Object} The root client ID, index to insert at and starting filter value. 5905 */ 5906 const getInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { 5907 if (typeof state.blockInserterPanel === 'object') { 5908 return state.blockInserterPanel; 5909 } 5910 if (getRenderingMode(state) === 'template-locked') { 5911 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); 5912 if (postContentClientId) { 5913 return { 5914 rootClientId: postContentClientId, 5915 insertionIndex: undefined, 5916 filterValue: undefined 5917 }; 5918 } 5919 } 5920 return EMPTY_INSERTION_POINT; 5921 }, state => { 5922 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); 5923 return [state.blockInserterPanel, getRenderingMode(state), postContentClientId]; 5924 })); 5925 function getListViewToggleRef(state) { 5926 return state.listViewToggleRef; 5927 } 5928 function getInserterSidebarToggleRef(state) { 5929 return state.inserterSidebarToggleRef; 5930 } 5931 const CARD_ICONS = { 5932 wp_block: library_symbol, 5933 wp_navigation: library_navigation, 5934 page: library_page, 5935 post: library_verse 5936 }; 5937 const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, options) => { 5938 { 5939 if (postType === 'wp_template_part' || postType === 'wp_template') { 5940 return __experimentalGetDefaultTemplatePartAreas(state).find(item => options.area === item.area)?.icon || library_layout; 5941 } 5942 if (CARD_ICONS[postType]) { 5943 return CARD_ICONS[postType]; 5944 } 5945 const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType); 5946 // `icon` is the `menu_icon` property of a post type. We 5947 // only handle `dashicons` for now, even if the `menu_icon` 5948 // also supports urls and svg as values. 5949 if (typeof postTypeEntity?.icon === 'string' && postTypeEntity.icon.startsWith('dashicons-')) { 5950 return postTypeEntity.icon.slice(10); 5951 } 5952 return library_page; 5953 } 5954 }); 5955 5956 /** 5957 * Returns the template parts and their blocks for the current edited template. 5958 * 5959 * @param {Object} state Global application state. 5960 * @return {Array} Template parts and their blocks in an array. 5961 */ 5962 const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 5963 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 5964 per_page: -1 5965 }); 5966 const clientIds = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/template-part'); 5967 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocksByClientId(clientIds); 5968 return memoizedGetFilteredTemplatePartBlocks(blocks, templateParts); 5969 }); 5970 5971 /** 5972 * Returns true if there are unsaved changes to the 5973 * post's meta fields, and false otherwise. 5974 * 5975 * @param {Object} state Global application state. 5976 * @param {string} postType The post type of the post. 5977 * @param {number} postId The ID of the post. 5978 * 5979 * @return {boolean} Whether there are edits or not in the meta fields of the relevant post. 5980 */ 5981 const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => { 5982 const { 5983 type: currentPostType, 5984 id: currentPostId 5985 } = getCurrentPost(state); 5986 // If no postType or postId is passed, use the current post. 5987 const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', postType || currentPostType, postId || currentPostId); 5988 if (!edits?.meta) { 5989 return false; 5990 } 5991 5992 // Compare if anything apart from `footnotes` has changed. 5993 const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType || currentPostType, postId || currentPostId)?.meta; 5994 return !fast_deep_equal_default()({ 5995 ...originalPostMeta, 5996 footnotes: undefined 5997 }, { 5998 ...edits.meta, 5999 footnotes: undefined 6000 }); 6001 }); 6002 6003 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js 6004 /** 6005 * WordPress dependencies 6006 */ 6007 6008 6009 /** 6010 * Internal dependencies 6011 */ 6012 6013 6014 6015 6016 6017 6018 6019 6020 /** 6021 * Post editor data store configuration. 6022 * 6023 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore 6024 * 6025 * @type {Object} 6026 */ 6027 const storeConfig = { 6028 reducer: reducer, 6029 selectors: selectors_namespaceObject, 6030 actions: actions_namespaceObject 6031 }; 6032 6033 /** 6034 * Store definition for the editor namespace. 6035 * 6036 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 6037 * 6038 * @type {Object} 6039 */ 6040 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 6041 ...storeConfig 6042 }); 6043 (0,external_wp_data_namespaceObject.register)(store_store); 6044 unlock(store_store).registerPrivateActions(private_actions_namespaceObject); 6045 unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject); 6046 6047 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/post-meta.js 6048 /** 6049 * WordPress dependencies 6050 */ 6051 6052 6053 6054 /** 6055 * Internal dependencies 6056 */ 6057 6058 /* harmony default export */ const post_meta = ({ 6059 name: 'core/post-meta', 6060 label: (0,external_wp_i18n_namespaceObject._x)('Post Meta', 'block bindings source'), 6061 getPlaceholder({ 6062 args 6063 }) { 6064 return args.key; 6065 }, 6066 getValue({ 6067 registry, 6068 context, 6069 args 6070 }) { 6071 return registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', context?.postType, context?.postId).meta?.[args.key]; 6072 }, 6073 setValue({ 6074 registry, 6075 context, 6076 args, 6077 value 6078 }) { 6079 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', context?.postType, context?.postId, { 6080 meta: { 6081 [args.key]: value 6082 } 6083 }); 6084 }, 6085 canUserEditValue({ 6086 select, 6087 context, 6088 args 6089 }) { 6090 // Lock editing in query loop. 6091 if (context?.query || context?.queryId) { 6092 return false; 6093 } 6094 const postType = context?.postType || select(store_store).getCurrentPostType(); 6095 6096 // Check that editing is happening in the post editor and not a template. 6097 if (postType === 'wp_template') { 6098 return false; 6099 } 6100 6101 // Check that the custom field is not protected and available in the REST API. 6102 const isFieldExposed = !!select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, context?.postId)?.meta?.[args.key]; 6103 if (!isFieldExposed) { 6104 return false; 6105 } 6106 6107 // Check that the user has the capability to edit post meta. 6108 const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUserEditEntityRecord('postType', context?.postType, context?.postId); 6109 if (!canUserEdit) { 6110 return false; 6111 } 6112 return true; 6113 } 6114 }); 6115 6116 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/index.js 6117 /** 6118 * WordPress dependencies 6119 */ 6120 6121 6122 /** 6123 * Internal dependencies 6124 */ 6125 6126 6127 6128 const { 6129 registerBlockBindingsSource 6130 } = unlock((0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store)); 6131 registerBlockBindingsSource(post_meta); 6132 registerBlockBindingsSource(pattern_overrides); 6133 6134 ;// CONCATENATED MODULE: external ["wp","compose"] 6135 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 6136 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js 6137 /** 6138 * WordPress dependencies 6139 */ 6140 6141 6142 6143 6144 6145 6146 /** 6147 * Internal dependencies 6148 */ 6149 6150 6151 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ 6152 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 6153 6154 /** 6155 * Object whose keys are the names of block attributes, where each value 6156 * represents the meta key to which the block attribute is intended to save. 6157 * 6158 * @see https://developer.wordpress.org/reference/functions/register_meta/ 6159 * 6160 * @typedef {Object<string,string>} WPMetaAttributeMapping 6161 */ 6162 6163 /** 6164 * Given a mapping of attribute names (meta source attributes) to their 6165 * associated meta key, returns a higher order component that overrides its 6166 * `attributes` and `setAttributes` props to sync any changes with the edited 6167 * post's meta keys. 6168 * 6169 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. 6170 * 6171 * @return {WPHigherOrderComponent} Higher-order component. 6172 */ 6173 6174 const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({ 6175 attributes, 6176 setAttributes, 6177 ...props 6178 }) => { 6179 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 6180 const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta'); 6181 const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 6182 ...attributes, 6183 ...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]])) 6184 }), [attributes, meta]); 6185 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 6186 attributes: mergedAttributes, 6187 setAttributes: nextAttributes => { 6188 const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( 6189 // Filter to intersection of keys between the updated 6190 // attributes and those with an associated meta key. 6191 ([key]) => key in metaAttributes).map(([attributeKey, value]) => [ 6192 // Rename the keys to the expected meta key name. 6193 metaAttributes[attributeKey], value])); 6194 if (Object.entries(nextMeta).length) { 6195 setMeta(nextMeta); 6196 } 6197 setAttributes(nextAttributes); 6198 }, 6199 ...props 6200 }); 6201 }, 'withMetaAttributeSource'); 6202 6203 /** 6204 * Filters a registered block's settings to enhance a block's `edit` component 6205 * to upgrade meta-sourced attributes to use the post's meta entity property. 6206 * 6207 * @param {WPBlockSettings} settings Registered block settings. 6208 * 6209 * @return {WPBlockSettings} Filtered block settings. 6210 */ 6211 function shimAttributeSource(settings) { 6212 var _settings$attributes; 6213 /** @type {WPMetaAttributeMapping} */ 6214 const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, { 6215 source 6216 }]) => source === 'meta').map(([attributeKey, { 6217 meta 6218 }]) => [attributeKey, meta])); 6219 if (Object.entries(metaAttributes).length) { 6220 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); 6221 } 6222 return settings; 6223 } 6224 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); 6225 6226 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js 6227 /** 6228 * WordPress dependencies 6229 */ 6230 6231 6232 6233 6234 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ 6235 6236 6237 6238 function getUserLabel(user) { 6239 const avatar = user.avatar_urls && user.avatar_urls[24] ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 6240 className: "editor-autocompleters__user-avatar", 6241 alt: "", 6242 src: user.avatar_urls[24] 6243 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 6244 className: "editor-autocompleters__no-avatar" 6245 }); 6246 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 6247 children: [avatar, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 6248 className: "editor-autocompleters__user-name", 6249 children: user.name 6250 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 6251 className: "editor-autocompleters__user-slug", 6252 children: user.slug 6253 })] 6254 }); 6255 } 6256 6257 /** 6258 * A user mentions completer. 6259 * 6260 * @type {WPCompleter} 6261 */ 6262 /* harmony default export */ const user = ({ 6263 name: 'users', 6264 className: 'editor-autocompleters__user', 6265 triggerPrefix: '@', 6266 useItems(filterValue) { 6267 const users = (0,external_wp_data_namespaceObject.useSelect)(select => { 6268 const { 6269 getUsers 6270 } = select(external_wp_coreData_namespaceObject.store); 6271 return getUsers({ 6272 context: 'view', 6273 search: encodeURIComponent(filterValue) 6274 }); 6275 }, [filterValue]); 6276 const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({ 6277 key: `user-$user.slug}`, 6278 value: user, 6279 label: getUserLabel(user) 6280 })) : [], [users]); 6281 return [options]; 6282 }, 6283 getOptionCompletion(user) { 6284 return `@$user.slug}`; 6285 } 6286 }); 6287 6288 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js 6289 /** 6290 * WordPress dependencies 6291 */ 6292 6293 6294 /** 6295 * Internal dependencies 6296 */ 6297 6298 function setDefaultCompleters(completers = []) { 6299 // Provide copies so filters may directly modify them. 6300 completers.push({ 6301 ...user 6302 }); 6303 return completers; 6304 } 6305 (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); 6306 6307 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] 6308 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 6309 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js 6310 /** 6311 * WordPress dependencies 6312 */ 6313 6314 6315 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/editor/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); 6316 6317 ;// CONCATENATED MODULE: external ["wp","patterns"] 6318 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 6319 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js 6320 /** 6321 * WordPress dependencies 6322 */ 6323 6324 6325 6326 6327 6328 6329 6330 /** 6331 * Internal dependencies 6332 */ 6333 6334 6335 6336 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 6337 6338 6339 6340 const { 6341 PatternOverridesControls, 6342 ResetOverridesControl, 6343 PatternOverridesBlockControls, 6344 PATTERN_TYPES, 6345 PARTIAL_SYNCING_SUPPORTED_BLOCKS, 6346 PATTERN_SYNC_TYPES 6347 } = unlock(external_wp_patterns_namespaceObject.privateApis); 6348 6349 /** 6350 * Override the default edit UI to include a new block inspector control for 6351 * assigning a partial syncing controls to supported blocks in the pattern editor. 6352 * Currently, only the `core/paragraph` block is supported. 6353 * 6354 * @param {Component} BlockEdit Original component. 6355 * 6356 * @return {Component} Wrapped component. 6357 */ 6358 const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { 6359 const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name]; 6360 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 6361 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 6362 ...props 6363 }), props.isSelected && isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, { 6364 ...props 6365 }), isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {})] 6366 }); 6367 }, 'withPatternOverrideControls'); 6368 6369 // Split into a separate component to avoid a store subscription 6370 // on every block. 6371 function ControlsWithStoreSubscription(props) { 6372 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 6373 const { 6374 hasPatternOverridesSource, 6375 isEditingSyncedPattern 6376 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6377 const { 6378 getBlockBindingsSource 6379 } = unlock(select(external_wp_blocks_namespaceObject.store)); 6380 const { 6381 getCurrentPostType, 6382 getEditedPostAttribute 6383 } = select(store_store); 6384 return { 6385 // For editing link to the site editor if the theme and user permissions support it. 6386 hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides'), 6387 isEditingSyncedPattern: getCurrentPostType() === PATTERN_TYPES.user && getEditedPostAttribute('meta')?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute('wp_pattern_sync_status') !== PATTERN_SYNC_TYPES.unsynced 6388 }; 6389 }, []); 6390 const bindings = props.attributes.metadata?.bindings; 6391 const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides'); 6392 const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === 'default'; 6393 const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings; 6394 if (!hasPatternOverridesSource) { 6395 return null; 6396 } 6397 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 6398 children: [shouldShowPatternOverridesControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, { 6399 ...props 6400 }), shouldShowResetOverridesControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, { 6401 ...props 6402 })] 6403 }); 6404 } 6405 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/with-pattern-override-controls', withPatternOverrideControls); 6406 6407 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js 6408 /** 6409 * Internal dependencies 6410 */ 6411 6412 6413 6414 6415 6416 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] 6417 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 6418 ;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs 6419 function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 6420 ;// CONCATENATED MODULE: external ["wp","components"] 6421 const external_wp_components_namespaceObject = window["wp"]["components"]; 6422 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 6423 /** 6424 * WordPress dependencies 6425 */ 6426 6427 6428 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6429 xmlns: "http://www.w3.org/2000/svg", 6430 viewBox: "0 0 24 24", 6431 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6432 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 6433 }) 6434 }); 6435 /* harmony default export */ const library_check = (check); 6436 6437 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js 6438 /** 6439 * WordPress dependencies 6440 */ 6441 6442 6443 const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6444 xmlns: "http://www.w3.org/2000/svg", 6445 viewBox: "0 0 24 24", 6446 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6447 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" 6448 }) 6449 }); 6450 /* harmony default export */ const star_filled = (starFilled); 6451 6452 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js 6453 /** 6454 * WordPress dependencies 6455 */ 6456 6457 6458 const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6459 xmlns: "http://www.w3.org/2000/svg", 6460 viewBox: "0 0 24 24", 6461 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6462 fillRule: "evenodd", 6463 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", 6464 clipRule: "evenodd" 6465 }) 6466 }); 6467 /* harmony default export */ const star_empty = (starEmpty); 6468 6469 ;// CONCATENATED MODULE: external ["wp","viewport"] 6470 const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; 6471 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 6472 /** 6473 * WordPress dependencies 6474 */ 6475 6476 6477 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6478 xmlns: "http://www.w3.org/2000/svg", 6479 viewBox: "0 0 24 24", 6480 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6481 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" 6482 }) 6483 }); 6484 /* harmony default export */ const close_small = (closeSmall); 6485 6486 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/deprecated.js 6487 /** 6488 * WordPress dependencies 6489 */ 6490 6491 function normalizeComplementaryAreaScope(scope) { 6492 if (['core/edit-post', 'core/edit-site'].includes(scope)) { 6493 external_wp_deprecated_default()(`$scope} interface scope`, { 6494 alternative: 'core interface scope', 6495 hint: 'core/edit-post and core/edit-site are merging.', 6496 version: '6.6' 6497 }); 6498 return 'core'; 6499 } 6500 return scope; 6501 } 6502 function normalizeComplementaryAreaName(scope, name) { 6503 if (scope === 'core' && name === 'edit-site/template') { 6504 external_wp_deprecated_default()(`edit-site/template sidebar`, { 6505 alternative: 'edit-post/document', 6506 version: '6.6' 6507 }); 6508 return 'edit-post/document'; 6509 } 6510 if (scope === 'core' && name === 'edit-site/block-inspector') { 6511 external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { 6512 alternative: 'edit-post/block', 6513 version: '6.6' 6514 }); 6515 return 'edit-post/block'; 6516 } 6517 return name; 6518 } 6519 6520 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js 6521 /** 6522 * WordPress dependencies 6523 */ 6524 6525 6526 6527 /** 6528 * Internal dependencies 6529 */ 6530 6531 6532 /** 6533 * Set a default complementary area. 6534 * 6535 * @param {string} scope Complementary area scope. 6536 * @param {string} area Area identifier. 6537 * 6538 * @return {Object} Action object. 6539 */ 6540 const setDefaultComplementaryArea = (scope, area) => { 6541 scope = normalizeComplementaryAreaScope(scope); 6542 area = normalizeComplementaryAreaName(scope, area); 6543 return { 6544 type: 'SET_DEFAULT_COMPLEMENTARY_AREA', 6545 scope, 6546 area 6547 }; 6548 }; 6549 6550 /** 6551 * Enable the complementary area. 6552 * 6553 * @param {string} scope Complementary area scope. 6554 * @param {string} area Area identifier. 6555 */ 6556 const enableComplementaryArea = (scope, area) => ({ 6557 registry, 6558 dispatch 6559 }) => { 6560 // Return early if there's no area. 6561 if (!area) { 6562 return; 6563 } 6564 scope = normalizeComplementaryAreaScope(scope); 6565 area = normalizeComplementaryAreaName(scope, area); 6566 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 6567 if (!isComplementaryAreaVisible) { 6568 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); 6569 } 6570 dispatch({ 6571 type: 'ENABLE_COMPLEMENTARY_AREA', 6572 scope, 6573 area 6574 }); 6575 }; 6576 6577 /** 6578 * Disable the complementary area. 6579 * 6580 * @param {string} scope Complementary area scope. 6581 */ 6582 const disableComplementaryArea = scope => ({ 6583 registry 6584 }) => { 6585 scope = normalizeComplementaryAreaScope(scope); 6586 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 6587 if (isComplementaryAreaVisible) { 6588 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); 6589 } 6590 }; 6591 6592 /** 6593 * Pins an item. 6594 * 6595 * @param {string} scope Item scope. 6596 * @param {string} item Item identifier. 6597 * 6598 * @return {Object} Action object. 6599 */ 6600 const pinItem = (scope, item) => ({ 6601 registry 6602 }) => { 6603 // Return early if there's no item. 6604 if (!item) { 6605 return; 6606 } 6607 scope = normalizeComplementaryAreaScope(scope); 6608 item = normalizeComplementaryAreaName(scope, item); 6609 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 6610 6611 // The item is already pinned, there's nothing to do. 6612 if (pinnedItems?.[item] === true) { 6613 return; 6614 } 6615 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 6616 ...pinnedItems, 6617 [item]: true 6618 }); 6619 }; 6620 6621 /** 6622 * Unpins an item. 6623 * 6624 * @param {string} scope Item scope. 6625 * @param {string} item Item identifier. 6626 */ 6627 const unpinItem = (scope, item) => ({ 6628 registry 6629 }) => { 6630 // Return early if there's no item. 6631 if (!item) { 6632 return; 6633 } 6634 scope = normalizeComplementaryAreaScope(scope); 6635 item = normalizeComplementaryAreaName(scope, item); 6636 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 6637 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 6638 ...pinnedItems, 6639 [item]: false 6640 }); 6641 }; 6642 6643 /** 6644 * Returns an action object used in signalling that a feature should be toggled. 6645 * 6646 * @param {string} scope The feature scope (e.g. core/edit-post). 6647 * @param {string} featureName The feature name. 6648 */ 6649 function toggleFeature(scope, featureName) { 6650 return function ({ 6651 registry 6652 }) { 6653 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { 6654 since: '6.0', 6655 alternative: `dispatch( 'core/preferences' ).toggle` 6656 }); 6657 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 6658 }; 6659 } 6660 6661 /** 6662 * Returns an action object used in signalling that a feature should be set to 6663 * a true or false value 6664 * 6665 * @param {string} scope The feature scope (e.g. core/edit-post). 6666 * @param {string} featureName The feature name. 6667 * @param {boolean} value The value to set. 6668 * 6669 * @return {Object} Action object. 6670 */ 6671 function setFeatureValue(scope, featureName, value) { 6672 return function ({ 6673 registry 6674 }) { 6675 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { 6676 since: '6.0', 6677 alternative: `dispatch( 'core/preferences' ).set` 6678 }); 6679 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 6680 }; 6681 } 6682 6683 /** 6684 * Returns an action object used in signalling that defaults should be set for features. 6685 * 6686 * @param {string} scope The feature scope (e.g. core/edit-post). 6687 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. 6688 * 6689 * @return {Object} Action object. 6690 */ 6691 function setFeatureDefaults(scope, defaults) { 6692 return function ({ 6693 registry 6694 }) { 6695 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { 6696 since: '6.0', 6697 alternative: `dispatch( 'core/preferences' ).setDefaults` 6698 }); 6699 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 6700 }; 6701 } 6702 6703 /** 6704 * Returns an action object used in signalling that the user opened a modal. 6705 * 6706 * @param {string} name A string that uniquely identifies the modal. 6707 * 6708 * @return {Object} Action object. 6709 */ 6710 function openModal(name) { 6711 return { 6712 type: 'OPEN_MODAL', 6713 name 6714 }; 6715 } 6716 6717 /** 6718 * Returns an action object signalling that the user closed a modal. 6719 * 6720 * @return {Object} Action object. 6721 */ 6722 function closeModal() { 6723 return { 6724 type: 'CLOSE_MODAL' 6725 }; 6726 } 6727 6728 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js 6729 /** 6730 * WordPress dependencies 6731 */ 6732 6733 6734 6735 6736 /** 6737 * Internal dependencies 6738 */ 6739 6740 6741 /** 6742 * Returns the complementary area that is active in a given scope. 6743 * 6744 * @param {Object} state Global application state. 6745 * @param {string} scope Item scope. 6746 * 6747 * @return {string | null | undefined} The complementary area that is active in the given scope. 6748 */ 6749 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 6750 scope = normalizeComplementaryAreaScope(scope); 6751 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 6752 6753 // Return `undefined` to indicate that the user has never toggled 6754 // visibility, this is the vanilla default. Other code relies on this 6755 // nuance in the return value. 6756 if (isComplementaryAreaVisible === undefined) { 6757 return undefined; 6758 } 6759 6760 // Return `null` to indicate the user hid the complementary area. 6761 if (isComplementaryAreaVisible === false) { 6762 return null; 6763 } 6764 return state?.complementaryAreas?.[scope]; 6765 }); 6766 const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 6767 scope = normalizeComplementaryAreaScope(scope); 6768 const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 6769 const identifier = state?.complementaryAreas?.[scope]; 6770 return isVisible && identifier === undefined; 6771 }); 6772 6773 /** 6774 * Returns a boolean indicating if an item is pinned or not. 6775 * 6776 * @param {Object} state Global application state. 6777 * @param {string} scope Scope. 6778 * @param {string} item Item to check. 6779 * 6780 * @return {boolean} True if the item is pinned and false otherwise. 6781 */ 6782 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { 6783 var _pinnedItems$item; 6784 scope = normalizeComplementaryAreaScope(scope); 6785 item = normalizeComplementaryAreaName(scope, item); 6786 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 6787 return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; 6788 }); 6789 6790 /** 6791 * Returns a boolean indicating whether a feature is active for a particular 6792 * scope. 6793 * 6794 * @param {Object} state The store state. 6795 * @param {string} scope The scope of the feature (e.g. core/edit-post). 6796 * @param {string} featureName The name of the feature. 6797 * 6798 * @return {boolean} Is the feature enabled? 6799 */ 6800 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { 6801 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { 6802 since: '6.0', 6803 alternative: `select( 'core/preferences' ).get( scope, featureName )` 6804 }); 6805 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 6806 }); 6807 6808 /** 6809 * Returns true if a modal is active, or false otherwise. 6810 * 6811 * @param {Object} state Global application state. 6812 * @param {string} modalName A string that uniquely identifies the modal. 6813 * 6814 * @return {boolean} Whether the modal is active. 6815 */ 6816 function isModalActive(state, modalName) { 6817 return state.activeModal === modalName; 6818 } 6819 6820 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js 6821 /** 6822 * WordPress dependencies 6823 */ 6824 6825 function complementaryAreas(state = {}, action) { 6826 switch (action.type) { 6827 case 'SET_DEFAULT_COMPLEMENTARY_AREA': 6828 { 6829 const { 6830 scope, 6831 area 6832 } = action; 6833 6834 // If there's already an area, don't overwrite it. 6835 if (state[scope]) { 6836 return state; 6837 } 6838 return { 6839 ...state, 6840 [scope]: area 6841 }; 6842 } 6843 case 'ENABLE_COMPLEMENTARY_AREA': 6844 { 6845 const { 6846 scope, 6847 area 6848 } = action; 6849 return { 6850 ...state, 6851 [scope]: area 6852 }; 6853 } 6854 } 6855 return state; 6856 } 6857 6858 /** 6859 * Reducer for storing the name of the open modal, or null if no modal is open. 6860 * 6861 * @param {Object} state Previous state. 6862 * @param {Object} action Action object containing the `name` of the modal 6863 * 6864 * @return {Object} Updated state 6865 */ 6866 function activeModal(state = null, action) { 6867 switch (action.type) { 6868 case 'OPEN_MODAL': 6869 return action.name; 6870 case 'CLOSE_MODAL': 6871 return null; 6872 } 6873 return state; 6874 } 6875 /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 6876 complementaryAreas, 6877 activeModal 6878 })); 6879 6880 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js 6881 /** 6882 * The identifier for the data store. 6883 * 6884 * @type {string} 6885 */ 6886 const constants_STORE_NAME = 'core/interface'; 6887 6888 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js 6889 /** 6890 * WordPress dependencies 6891 */ 6892 6893 6894 /** 6895 * Internal dependencies 6896 */ 6897 6898 6899 6900 6901 6902 /** 6903 * Store definition for the interface namespace. 6904 * 6905 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 6906 * 6907 * @type {Object} 6908 */ 6909 const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 6910 reducer: store_reducer, 6911 actions: store_actions_namespaceObject, 6912 selectors: store_selectors_namespaceObject 6913 }); 6914 6915 // Once we build a more generic persistence plugin that works across types of stores 6916 // we'd be able to replace this with a register call. 6917 (0,external_wp_data_namespaceObject.register)(store); 6918 6919 ;// CONCATENATED MODULE: external ["wp","plugins"] 6920 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 6921 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js 6922 /** 6923 * WordPress dependencies 6924 */ 6925 6926 /* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 6927 return { 6928 icon: ownProps.icon || context.icon, 6929 identifier: ownProps.identifier || `$context.name}/$ownProps.name}` 6930 }; 6931 })); 6932 6933 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js 6934 /** 6935 * WordPress dependencies 6936 */ 6937 6938 6939 6940 /** 6941 * Internal dependencies 6942 */ 6943 6944 6945 6946 function ComplementaryAreaToggle({ 6947 as = external_wp_components_namespaceObject.Button, 6948 scope, 6949 identifier, 6950 icon, 6951 selectedIcon, 6952 name, 6953 ...props 6954 }) { 6955 const ComponentToUse = as; 6956 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]); 6957 const { 6958 enableComplementaryArea, 6959 disableComplementaryArea 6960 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 6961 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, { 6962 icon: selectedIcon && isSelected ? selectedIcon : icon, 6963 "aria-controls": identifier.replace('/', ':'), 6964 onClick: () => { 6965 if (isSelected) { 6966 disableComplementaryArea(scope); 6967 } else { 6968 enableComplementaryArea(scope, identifier); 6969 } 6970 }, 6971 ...props 6972 }); 6973 } 6974 /* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); 6975 6976 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js 6977 /** 6978 * External dependencies 6979 */ 6980 6981 6982 /** 6983 * WordPress dependencies 6984 */ 6985 6986 6987 /** 6988 * Internal dependencies 6989 */ 6990 6991 6992 6993 6994 const ComplementaryAreaHeader = ({ 6995 smallScreenTitle, 6996 children, 6997 className, 6998 toggleButtonProps 6999 }) => { 7000 const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, { 7001 icon: close_small, 7002 ...toggleButtonProps 7003 }); 7004 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 7005 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 7006 className: "components-panel__header interface-complementary-area-header__small", 7007 children: [smallScreenTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 7008 className: "interface-complementary-area-header__small-title", 7009 children: smallScreenTitle 7010 }), toggleButton] 7011 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 7012 className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className), 7013 tabIndex: -1, 7014 children: [children, toggleButton] 7015 })] 7016 }); 7017 }; 7018 /* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); 7019 7020 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js 7021 /** 7022 * WordPress dependencies 7023 */ 7024 7025 7026 7027 const noop = () => {}; 7028 function ActionItemSlot({ 7029 name, 7030 as: Component = external_wp_components_namespaceObject.ButtonGroup, 7031 fillProps = {}, 7032 bubblesVirtually, 7033 ...props 7034 }) { 7035 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 7036 name: name, 7037 bubblesVirtually: bubblesVirtually, 7038 fillProps: fillProps, 7039 children: fills => { 7040 if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { 7041 return null; 7042 } 7043 7044 // Special handling exists for backward compatibility. 7045 // It ensures that menu items created by plugin authors aren't 7046 // duplicated with automatically injected menu items coming 7047 // from pinnable plugin sidebars. 7048 // @see https://github.com/WordPress/gutenberg/issues/14457 7049 const initializedByPlugins = []; 7050 external_wp_element_namespaceObject.Children.forEach(fills, ({ 7051 props: { 7052 __unstableExplicitMenuItem, 7053 __unstableTarget 7054 } 7055 }) => { 7056 if (__unstableTarget && __unstableExplicitMenuItem) { 7057 initializedByPlugins.push(__unstableTarget); 7058 } 7059 }); 7060 const children = external_wp_element_namespaceObject.Children.map(fills, child => { 7061 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { 7062 return null; 7063 } 7064 return child; 7065 }); 7066 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { 7067 ...props, 7068 children: children 7069 }); 7070 } 7071 }); 7072 } 7073 function ActionItem({ 7074 name, 7075 as: Component = external_wp_components_namespaceObject.Button, 7076 onClick, 7077 ...props 7078 }) { 7079 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 7080 name: name, 7081 children: ({ 7082 onClick: fpOnClick 7083 }) => { 7084 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { 7085 onClick: onClick || fpOnClick ? (...args) => { 7086 (onClick || noop)(...args); 7087 (fpOnClick || noop)(...args); 7088 } : undefined, 7089 ...props 7090 }); 7091 } 7092 }); 7093 } 7094 ActionItem.Slot = ActionItemSlot; 7095 /* harmony default export */ const action_item = (ActionItem); 7096 7097 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js 7098 /** 7099 * WordPress dependencies 7100 */ 7101 7102 7103 7104 /** 7105 * Internal dependencies 7106 */ 7107 7108 7109 7110 const PluginsMenuItem = ({ 7111 // Menu item is marked with unstable prop for backward compatibility. 7112 // They are removed so they don't leak to DOM elements. 7113 // @see https://github.com/WordPress/gutenberg/issues/14457 7114 __unstableExplicitMenuItem, 7115 __unstableTarget, 7116 ...restProps 7117 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 7118 ...restProps 7119 }); 7120 function ComplementaryAreaMoreMenuItem({ 7121 scope, 7122 target, 7123 __unstableExplicitMenuItem, 7124 ...props 7125 }) { 7126 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, { 7127 as: toggleProps => { 7128 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { 7129 __unstableExplicitMenuItem: __unstableExplicitMenuItem, 7130 __unstableTarget: `$scope}/$target}`, 7131 as: PluginsMenuItem, 7132 name: `$scope}/plugin-more-menu`, 7133 ...toggleProps 7134 }); 7135 }, 7136 role: "menuitemcheckbox", 7137 selectedIcon: library_check, 7138 name: target, 7139 scope: scope, 7140 ...props 7141 }); 7142 } 7143 7144 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js 7145 /** 7146 * External dependencies 7147 */ 7148 7149 7150 /** 7151 * WordPress dependencies 7152 */ 7153 7154 7155 function PinnedItems({ 7156 scope, 7157 ...props 7158 }) { 7159 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 7160 name: `PinnedItems/$scope}`, 7161 ...props 7162 }); 7163 } 7164 function PinnedItemsSlot({ 7165 scope, 7166 className, 7167 ...props 7168 }) { 7169 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 7170 name: `PinnedItems/$scope}`, 7171 ...props, 7172 children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7173 className: dist_clsx(className, 'interface-pinned-items'), 7174 children: fills 7175 }) 7176 }); 7177 } 7178 PinnedItems.Slot = PinnedItemsSlot; 7179 /* harmony default export */ const pinned_items = (PinnedItems); 7180 7181 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js 7182 /** 7183 * External dependencies 7184 */ 7185 7186 7187 /** 7188 * WordPress dependencies 7189 */ 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 /** 7200 * Internal dependencies 7201 */ 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 const ANIMATION_DURATION = 0.3; 7212 function ComplementaryAreaSlot({ 7213 scope, 7214 ...props 7215 }) { 7216 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 7217 name: `ComplementaryArea/$scope}`, 7218 ...props 7219 }); 7220 } 7221 const SIDEBAR_WIDTH = 280; 7222 const variants = { 7223 open: { 7224 width: SIDEBAR_WIDTH 7225 }, 7226 closed: { 7227 width: 0 7228 }, 7229 mobileOpen: { 7230 width: '100vw' 7231 } 7232 }; 7233 function ComplementaryAreaFill({ 7234 activeArea, 7235 isActive, 7236 scope, 7237 children, 7238 className, 7239 id 7240 }) { 7241 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 7242 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 7243 // This is used to delay the exit animation to the next tick. 7244 // The reason this is done is to allow us to apply the right transition properties 7245 // When we switch from an open sidebar to another open sidebar. 7246 // we don't want to animate in this case. 7247 const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); 7248 const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); 7249 const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); 7250 (0,external_wp_element_namespaceObject.useEffect)(() => { 7251 setState({}); 7252 }, [isActive]); 7253 const transition = { 7254 type: 'tween', 7255 duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, 7256 ease: [0.6, 0, 0.4, 1] 7257 }; 7258 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 7259 name: `ComplementaryArea/$scope}`, 7260 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 7261 initial: false, 7262 children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 7263 variants: variants, 7264 initial: "closed", 7265 animate: isMobileViewport ? 'mobileOpen' : 'open', 7266 exit: "closed", 7267 transition: transition, 7268 className: "interface-complementary-area__fill", 7269 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7270 id: id, 7271 className: className, 7272 style: { 7273 width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH 7274 }, 7275 children: children 7276 }) 7277 }) 7278 }) 7279 }); 7280 } 7281 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 7282 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); 7283 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); 7284 const { 7285 enableComplementaryArea, 7286 disableComplementaryArea 7287 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 7288 (0,external_wp_element_namespaceObject.useEffect)(() => { 7289 // If the complementary area is active and the editor is switching from 7290 // a big to a small window size. 7291 if (isActive && isSmall && !previousIsSmall.current) { 7292 disableComplementaryArea(scope); 7293 // Flag the complementary area to be reopened when the window size 7294 // goes from small to big. 7295 shouldOpenWhenNotSmall.current = true; 7296 } else if ( 7297 // If there is a flag indicating the complementary area should be 7298 // enabled when we go from small to big window size and we are going 7299 // from a small to big window size. 7300 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { 7301 // Remove the flag indicating the complementary area should be 7302 // enabled. 7303 shouldOpenWhenNotSmall.current = false; 7304 enableComplementaryArea(scope, identifier); 7305 } else if ( 7306 // If the flag is indicating the current complementary should be 7307 // reopened but another complementary area becomes active, remove 7308 // the flag. 7309 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { 7310 shouldOpenWhenNotSmall.current = false; 7311 } 7312 if (isSmall !== previousIsSmall.current) { 7313 previousIsSmall.current = isSmall; 7314 } 7315 }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]); 7316 } 7317 function ComplementaryArea({ 7318 children, 7319 className, 7320 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), 7321 identifier, 7322 header, 7323 headerClassName, 7324 icon, 7325 isPinnable = true, 7326 panelClassName, 7327 scope, 7328 name, 7329 smallScreenTitle, 7330 title, 7331 toggleShortcut, 7332 isActiveByDefault 7333 }) { 7334 // This state is used to delay the rendering of the Fill 7335 // until the initial effect runs. 7336 // This prevents the animation from running on mount if 7337 // the complementary area is active by default. 7338 const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); 7339 const { 7340 isLoading, 7341 isActive, 7342 isPinned, 7343 activeArea, 7344 isSmall, 7345 isLarge, 7346 showIconLabels 7347 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7348 const { 7349 getActiveComplementaryArea, 7350 isComplementaryAreaLoading, 7351 isItemPinned 7352 } = select(store); 7353 const { 7354 get 7355 } = select(external_wp_preferences_namespaceObject.store); 7356 const _activeArea = getActiveComplementaryArea(scope); 7357 return { 7358 isLoading: isComplementaryAreaLoading(scope), 7359 isActive: _activeArea === identifier, 7360 isPinned: isItemPinned(scope, identifier), 7361 activeArea: _activeArea, 7362 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), 7363 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), 7364 showIconLabels: get('core', 'showIconLabels') 7365 }; 7366 }, [identifier, scope]); 7367 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); 7368 const { 7369 enableComplementaryArea, 7370 disableComplementaryArea, 7371 pinItem, 7372 unpinItem 7373 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 7374 (0,external_wp_element_namespaceObject.useEffect)(() => { 7375 // Set initial visibility: For large screens, enable if it's active by 7376 // default. For small screens, always initially disable. 7377 if (isActiveByDefault && activeArea === undefined && !isSmall) { 7378 enableComplementaryArea(scope, identifier); 7379 } else if (activeArea === undefined && isSmall) { 7380 disableComplementaryArea(scope, identifier); 7381 } 7382 setIsReady(true); 7383 }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); 7384 if (!isReady) { 7385 return; 7386 } 7387 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 7388 children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, { 7389 scope: scope, 7390 children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, { 7391 scope: scope, 7392 identifier: identifier, 7393 isPressed: isActive && (!showIconLabels || isLarge), 7394 "aria-expanded": isActive, 7395 "aria-disabled": isLoading, 7396 label: title, 7397 icon: showIconLabels ? library_check : icon, 7398 showTooltip: !showIconLabels, 7399 variant: showIconLabels ? 'tertiary' : undefined, 7400 size: "compact" 7401 }) 7402 }), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 7403 target: name, 7404 scope: scope, 7405 icon: icon, 7406 children: title 7407 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, { 7408 activeArea: activeArea, 7409 isActive: isActive, 7410 className: dist_clsx('interface-complementary-area', className), 7411 scope: scope, 7412 id: identifier.replace('/', ':'), 7413 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, { 7414 className: headerClassName, 7415 closeLabel: closeLabel, 7416 onClose: () => disableComplementaryArea(scope), 7417 smallScreenTitle: smallScreenTitle, 7418 toggleButtonProps: { 7419 label: closeLabel, 7420 size: 'small', 7421 shortcut: toggleShortcut, 7422 scope, 7423 identifier 7424 }, 7425 children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 7426 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 7427 className: "interface-complementary-area-header__title", 7428 children: title 7429 }), isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7430 className: "interface-complementary-area__pin-unpin-item", 7431 icon: isPinned ? star_filled : star_empty, 7432 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), 7433 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), 7434 isPressed: isPinned, 7435 "aria-expanded": isPinned, 7436 size: "compact" 7437 })] 7438 }) 7439 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { 7440 className: panelClassName, 7441 children: children 7442 })] 7443 })] 7444 }); 7445 } 7446 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); 7447 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; 7448 /* harmony default export */ const complementary_area = (ComplementaryAreaWrapped); 7449 7450 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js 7451 /** 7452 * WordPress dependencies 7453 */ 7454 7455 const FullscreenMode = ({ 7456 isActive 7457 }) => { 7458 (0,external_wp_element_namespaceObject.useEffect)(() => { 7459 let isSticky = false; 7460 // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes 7461 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled 7462 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as 7463 // a consequence of the FullscreenMode setup. 7464 if (document.body.classList.contains('sticky-menu')) { 7465 isSticky = true; 7466 document.body.classList.remove('sticky-menu'); 7467 } 7468 return () => { 7469 if (isSticky) { 7470 document.body.classList.add('sticky-menu'); 7471 } 7472 }; 7473 }, []); 7474 (0,external_wp_element_namespaceObject.useEffect)(() => { 7475 if (isActive) { 7476 document.body.classList.add('is-fullscreen-mode'); 7477 } else { 7478 document.body.classList.remove('is-fullscreen-mode'); 7479 } 7480 return () => { 7481 if (isActive) { 7482 document.body.classList.remove('is-fullscreen-mode'); 7483 } 7484 }; 7485 }, [isActive]); 7486 return null; 7487 }; 7488 /* harmony default export */ const fullscreen_mode = (FullscreenMode); 7489 7490 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js 7491 /** 7492 * External dependencies 7493 */ 7494 7495 7496 function NavigableRegion({ 7497 children, 7498 className, 7499 ariaLabel, 7500 as: Tag = 'div', 7501 ...props 7502 }) { 7503 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { 7504 className: dist_clsx('interface-navigable-region', className), 7505 "aria-label": ariaLabel, 7506 role: "region", 7507 tabIndex: "-1", 7508 ...props, 7509 children: children 7510 }); 7511 } 7512 7513 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js 7514 /** 7515 * External dependencies 7516 */ 7517 7518 7519 /** 7520 * WordPress dependencies 7521 */ 7522 7523 7524 7525 7526 7527 /** 7528 * Internal dependencies 7529 */ 7530 7531 7532 7533 const interface_skeleton_ANIMATION_DURATION = 0.25; 7534 const commonTransition = { 7535 type: 'tween', 7536 duration: interface_skeleton_ANIMATION_DURATION, 7537 ease: [0.6, 0, 0.4, 1] 7538 }; 7539 function useHTMLClass(className) { 7540 (0,external_wp_element_namespaceObject.useEffect)(() => { 7541 const element = document && document.querySelector(`html:not(.$className})`); 7542 if (!element) { 7543 return; 7544 } 7545 element.classList.toggle(className); 7546 return () => { 7547 element.classList.toggle(className); 7548 }; 7549 }, [className]); 7550 } 7551 const headerVariants = { 7552 hidden: { 7553 opacity: 1, 7554 marginTop: -60 7555 }, 7556 visible: { 7557 opacity: 1, 7558 marginTop: 0 7559 }, 7560 distractionFreeHover: { 7561 opacity: 1, 7562 marginTop: 0, 7563 transition: { 7564 ...commonTransition, 7565 delay: 0.2, 7566 delayChildren: 0.2 7567 } 7568 }, 7569 distractionFreeHidden: { 7570 opacity: 0, 7571 marginTop: -60 7572 }, 7573 distractionFreeDisabled: { 7574 opacity: 0, 7575 marginTop: 0, 7576 transition: { 7577 ...commonTransition, 7578 delay: 0.8, 7579 delayChildren: 0.8 7580 } 7581 } 7582 }; 7583 function InterfaceSkeleton({ 7584 isDistractionFree, 7585 footer, 7586 header, 7587 editorNotices, 7588 sidebar, 7589 secondarySidebar, 7590 content, 7591 actions, 7592 labels, 7593 className, 7594 enableRegionNavigation = true, 7595 // Todo: does this need to be a prop. 7596 // Can we use a dependency to keyboard-shortcuts directly? 7597 shortcuts 7598 }, ref) { 7599 const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 7600 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 7601 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 7602 const defaultTransition = { 7603 type: 'tween', 7604 duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, 7605 ease: [0.6, 0, 0.4, 1] 7606 }; 7607 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); 7608 useHTMLClass('interface-interface-skeleton__html-container'); 7609 const defaultLabels = { 7610 /* translators: accessibility text for the top bar landmark region. */ 7611 header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), 7612 /* translators: accessibility text for the content landmark region. */ 7613 body: (0,external_wp_i18n_namespaceObject.__)('Content'), 7614 /* translators: accessibility text for the secondary sidebar landmark region. */ 7615 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), 7616 /* translators: accessibility text for the settings landmark region. */ 7617 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), 7618 /* translators: accessibility text for the publish landmark region. */ 7619 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), 7620 /* translators: accessibility text for the footer landmark region. */ 7621 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') 7622 }; 7623 const mergedLabels = { 7624 ...defaultLabels, 7625 ...labels 7626 }; 7627 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 7628 ...(enableRegionNavigation ? navigateRegionsProps : {}), 7629 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]), 7630 className: dist_clsx(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer'), 7631 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 7632 className: "interface-interface-skeleton__editor", 7633 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 7634 initial: false, 7635 children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, { 7636 as: external_wp_components_namespaceObject.__unstableMotion.div, 7637 className: "interface-interface-skeleton__header", 7638 "aria-label": mergedLabels.header, 7639 initial: isDistractionFree ? 'distractionFreeHidden' : 'hidden', 7640 whileHover: isDistractionFree ? 'distractionFreeHover' : 'visible', 7641 animate: isDistractionFree ? 'distractionFreeDisabled' : 'visible', 7642 exit: isDistractionFree ? 'distractionFreeHidden' : 'hidden', 7643 variants: headerVariants, 7644 transition: defaultTransition, 7645 children: header 7646 }) 7647 }), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7648 className: "interface-interface-skeleton__header", 7649 children: editorNotices 7650 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 7651 className: "interface-interface-skeleton__body", 7652 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 7653 initial: false, 7654 children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, { 7655 className: "interface-interface-skeleton__secondary-sidebar", 7656 ariaLabel: mergedLabels.secondarySidebar, 7657 as: external_wp_components_namespaceObject.__unstableMotion.div, 7658 initial: "closed", 7659 animate: isMobileViewport ? 'mobileOpen' : 'open', 7660 exit: "closed", 7661 variants: { 7662 open: { 7663 width: secondarySidebarSize.width 7664 }, 7665 closed: { 7666 width: 0 7667 }, 7668 mobileOpen: { 7669 width: '100vw' 7670 } 7671 }, 7672 transition: defaultTransition, 7673 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 7674 style: { 7675 position: 'absolute', 7676 width: isMobileViewport ? '100vw' : 'fit-content', 7677 height: '100%', 7678 right: 0 7679 }, 7680 children: [secondarySidebarResizeListener, secondarySidebar] 7681 }) 7682 }) 7683 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, { 7684 className: "interface-interface-skeleton__content", 7685 ariaLabel: mergedLabels.body, 7686 children: content 7687 }), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, { 7688 className: "interface-interface-skeleton__sidebar", 7689 ariaLabel: mergedLabels.sidebar, 7690 children: sidebar 7691 }), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, { 7692 className: "interface-interface-skeleton__actions", 7693 ariaLabel: mergedLabels.actions, 7694 children: actions 7695 })] 7696 })] 7697 }), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, { 7698 className: "interface-interface-skeleton__footer", 7699 ariaLabel: mergedLabels.footer, 7700 children: footer 7701 })] 7702 }); 7703 } 7704 /* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); 7705 7706 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js 7707 7708 7709 7710 7711 7712 7713 7714 7715 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js 7716 7717 7718 7719 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js 7720 /** 7721 * WordPress dependencies 7722 */ 7723 7724 7725 7726 7727 7728 /** 7729 * Internal dependencies 7730 */ 7731 7732 7733 /** 7734 * Component handles the keyboard shortcuts for the editor. 7735 * 7736 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 7737 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 7738 * and toggling the sidebar. 7739 */ 7740 function EditorKeyboardShortcuts() { 7741 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { 7742 const { 7743 richEditingEnabled, 7744 codeEditingEnabled 7745 } = select(store_store).getEditorSettings(); 7746 return !richEditingEnabled || !codeEditingEnabled; 7747 }, []); 7748 const { 7749 getBlockSelectionStart 7750 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 7751 const { 7752 getActiveComplementaryArea 7753 } = (0,external_wp_data_namespaceObject.useSelect)(store); 7754 const { 7755 enableComplementaryArea, 7756 disableComplementaryArea 7757 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 7758 const { 7759 redo, 7760 undo, 7761 savePost, 7762 setIsListViewOpened, 7763 switchEditorMode, 7764 toggleDistractionFree 7765 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 7766 const { 7767 isEditedPostDirty, 7768 isPostSavingLocked, 7769 isListViewOpened, 7770 getEditorMode 7771 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 7772 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-mode', () => { 7773 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); 7774 }, { 7775 isDisabled: isModeToggleDisabled 7776 }); 7777 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-distraction-free', () => { 7778 toggleDistractionFree(); 7779 }); 7780 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => { 7781 undo(); 7782 event.preventDefault(); 7783 }); 7784 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => { 7785 redo(); 7786 event.preventDefault(); 7787 }); 7788 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => { 7789 event.preventDefault(); 7790 7791 /** 7792 * Do not save the post if post saving is locked. 7793 */ 7794 if (isPostSavingLocked()) { 7795 return; 7796 } 7797 7798 // TODO: This should be handled in the `savePost` effect in 7799 // considering `isSaveable`. See note on `isEditedPostSaveable` 7800 // selector about dirtiness and meta-boxes. 7801 // 7802 // See: `isEditedPostSaveable` 7803 if (!isEditedPostDirty()) { 7804 return; 7805 } 7806 savePost(); 7807 }); 7808 7809 // Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar. 7810 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', event => { 7811 if (!isListViewOpened()) { 7812 event.preventDefault(); 7813 setIsListViewOpened(true); 7814 } 7815 }); 7816 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-sidebar', event => { 7817 // This shortcut has no known clashes, but use preventDefault to prevent any 7818 // obscure shortcuts from triggering. 7819 event.preventDefault(); 7820 const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(getActiveComplementaryArea('core')); 7821 if (isEditorSidebarOpened) { 7822 disableComplementaryArea('core'); 7823 } else { 7824 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document'; 7825 enableComplementaryArea('core', sidebarToOpen); 7826 } 7827 }); 7828 return null; 7829 } 7830 7831 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js 7832 7833 7834 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js 7835 /** 7836 * WordPress dependencies 7837 */ 7838 7839 7840 7841 7842 7843 /** 7844 * Internal dependencies 7845 */ 7846 7847 class AutosaveMonitor extends external_wp_element_namespaceObject.Component { 7848 constructor(props) { 7849 super(props); 7850 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); 7851 } 7852 componentDidMount() { 7853 if (!this.props.disableIntervalChecks) { 7854 this.setAutosaveTimer(); 7855 } 7856 } 7857 componentDidUpdate(prevProps) { 7858 if (this.props.disableIntervalChecks) { 7859 if (this.props.editsReference !== prevProps.editsReference) { 7860 this.props.autosave(); 7861 } 7862 return; 7863 } 7864 if (this.props.interval !== prevProps.interval) { 7865 clearTimeout(this.timerId); 7866 this.setAutosaveTimer(); 7867 } 7868 if (!this.props.isDirty) { 7869 this.needsAutosave = false; 7870 return; 7871 } 7872 if (this.props.isAutosaving && !prevProps.isAutosaving) { 7873 this.needsAutosave = false; 7874 return; 7875 } 7876 if (this.props.editsReference !== prevProps.editsReference) { 7877 this.needsAutosave = true; 7878 } 7879 } 7880 componentWillUnmount() { 7881 clearTimeout(this.timerId); 7882 } 7883 setAutosaveTimer(timeout = this.props.interval * 1000) { 7884 this.timerId = setTimeout(() => { 7885 this.autosaveTimerHandler(); 7886 }, timeout); 7887 } 7888 autosaveTimerHandler() { 7889 if (!this.props.isAutosaveable) { 7890 this.setAutosaveTimer(1000); 7891 return; 7892 } 7893 if (this.needsAutosave) { 7894 this.needsAutosave = false; 7895 this.props.autosave(); 7896 } 7897 this.setAutosaveTimer(); 7898 } 7899 render() { 7900 return null; 7901 } 7902 } 7903 7904 /** 7905 * Monitors the changes made to the edited post and triggers autosave if necessary. 7906 * 7907 * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. 7908 * 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 7909 * the specific way of detecting changes. 7910 * 7911 * There are two caveats: 7912 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. 7913 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. 7914 * 7915 * @param {Object} props - The properties passed to the component. 7916 * @param {Function} props.autosave - The function to call when changes need to be saved. 7917 * @param {number} props.interval - The maximum time in seconds between an unsaved change and an autosave. 7918 * @param {boolean} props.isAutosaveable - If false, the check for changes is retried every second. 7919 * @param {boolean} props.disableIntervalChecks - If true, disables the timer and any change will immediately trigger `props.autosave()`. 7920 * @param {boolean} props.isDirty - Indicates if there are unsaved changes. 7921 * 7922 * @example 7923 * ```jsx 7924 * <AutosaveMonitor interval={30000} /> 7925 * ``` 7926 */ 7927 /* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { 7928 const { 7929 getReferenceByDistinctEdits 7930 } = select(external_wp_coreData_namespaceObject.store); 7931 const { 7932 isEditedPostDirty, 7933 isEditedPostAutosaveable, 7934 isAutosavingPost, 7935 getEditorSettings 7936 } = select(store_store); 7937 const { 7938 interval = getEditorSettings().autosaveInterval 7939 } = ownProps; 7940 return { 7941 editsReference: getReferenceByDistinctEdits(), 7942 isDirty: isEditedPostDirty(), 7943 isAutosaveable: isEditedPostAutosaveable(), 7944 isAutosaving: isAutosavingPost(), 7945 interval 7946 }; 7947 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ 7948 autosave() { 7949 const { 7950 autosave = dispatch(store_store).autosave 7951 } = ownProps; 7952 autosave(); 7953 } 7954 }))])(AutosaveMonitor)); 7955 7956 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 7957 /** 7958 * WordPress dependencies 7959 */ 7960 7961 7962 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7963 xmlns: "http://www.w3.org/2000/svg", 7964 viewBox: "0 0 24 24", 7965 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7966 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 7967 }) 7968 }); 7969 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 7970 7971 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 7972 /** 7973 * WordPress dependencies 7974 */ 7975 7976 7977 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7978 xmlns: "http://www.w3.org/2000/svg", 7979 viewBox: "0 0 24 24", 7980 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7981 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 7982 }) 7983 }); 7984 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 7985 7986 ;// CONCATENATED MODULE: external ["wp","keycodes"] 7987 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 7988 ;// CONCATENATED MODULE: external ["wp","commands"] 7989 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 7990 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js 7991 /** 7992 * External dependencies 7993 */ 7994 7995 7996 /** 7997 * WordPress dependencies 7998 */ 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 /** 8012 * Internal dependencies 8013 */ 8014 8015 8016 8017 8018 8019 const TYPE_LABELS = { 8020 // translators: 1: Pattern title. 8021 wp_pattern: (0,external_wp_i18n_namespaceObject.__)('Editing pattern: %s'), 8022 // translators: 1: Navigation menu title. 8023 wp_navigation: (0,external_wp_i18n_namespaceObject.__)('Editing navigation menu: %s'), 8024 // translators: 1: Template title. 8025 wp_template: (0,external_wp_i18n_namespaceObject.__)('Editing template: %s'), 8026 // translators: 1: Template part title. 8027 wp_template_part: (0,external_wp_i18n_namespaceObject.__)('Editing template part: %s') 8028 }; 8029 const MotionButton = (0,external_wp_components_namespaceObject.__unstableMotion)(external_wp_components_namespaceObject.Button); 8030 8031 /** 8032 * This component renders a navigation bar at the top of the editor. It displays the title of the current document, 8033 * a back button (if applicable), and a command center button. It also handles different states of the document, 8034 * such as "not found" or "unsynced". 8035 * 8036 * @example 8037 * ```jsx 8038 * <DocumentBar /> 8039 * ``` 8040 * 8041 * @return {JSX.Element} The rendered DocumentBar component. 8042 */ 8043 function DocumentBar() { 8044 const { 8045 postType, 8046 documentTitle, 8047 isNotFound, 8048 isUnsyncedPattern, 8049 templateIcon, 8050 templateTitle, 8051 onNavigateToPreviousEntityRecord 8052 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8053 const { 8054 getCurrentPostType, 8055 getCurrentPostId, 8056 getEditorSettings, 8057 __experimentalGetTemplateInfo: getTemplateInfo 8058 } = select(store_store); 8059 const { 8060 getEditedEntityRecord, 8061 isResolving: isResolvingSelector 8062 } = select(external_wp_coreData_namespaceObject.store); 8063 const _postType = getCurrentPostType(); 8064 const _postId = getCurrentPostId(); 8065 const _document = getEditedEntityRecord('postType', _postType, _postId); 8066 const _templateInfo = getTemplateInfo(_document); 8067 return { 8068 postType: _postType, 8069 documentTitle: _document.title, 8070 isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId), 8071 isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced', 8072 templateIcon: unlock(select(store_store)).getPostIcon(_postType, { 8073 area: _document?.area 8074 }), 8075 templateTitle: _templateInfo.title, 8076 onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord 8077 }; 8078 }, []); 8079 const { 8080 open: openCommandCenter 8081 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 8082 const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 8083 const isTemplate = TEMPLATE_POST_TYPES.includes(postType); 8084 const isGlobalEntity = GLOBAL_POST_TYPES.includes(postType); 8085 const hasBackButton = !!onNavigateToPreviousEntityRecord; 8086 const title = isTemplate ? templateTitle : documentTitle; 8087 const mounted = (0,external_wp_element_namespaceObject.useRef)(false); 8088 (0,external_wp_element_namespaceObject.useEffect)(() => { 8089 mounted.current = true; 8090 }, []); 8091 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 8092 className: dist_clsx('editor-document-bar', { 8093 'has-back-button': hasBackButton, 8094 'is-global': isGlobalEntity && !isUnsyncedPattern 8095 }), 8096 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 8097 children: hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MotionButton, { 8098 className: "editor-document-bar__back", 8099 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small, 8100 onClick: event => { 8101 event.stopPropagation(); 8102 onNavigateToPreviousEntityRecord(); 8103 }, 8104 size: "compact", 8105 initial: mounted.current ? { 8106 opacity: 0, 8107 transform: 'translateX(15%)' 8108 } : false // Don't show entry animation when DocumentBar mounts. 8109 , 8110 animate: { 8111 opacity: 1, 8112 transform: 'translateX(0%)' 8113 }, 8114 exit: { 8115 opacity: 0, 8116 transform: 'translateX(15%)' 8117 }, 8118 transition: isReducedMotion ? { 8119 duration: 0 8120 } : undefined, 8121 children: (0,external_wp_i18n_namespaceObject.__)('Back') 8122 }) 8123 }), isNotFound ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 8124 children: (0,external_wp_i18n_namespaceObject.__)('Document not found') 8125 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 8126 className: "editor-document-bar__command", 8127 onClick: () => openCommandCenter(), 8128 size: "compact", 8129 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 8130 className: "editor-document-bar__title" 8131 // Force entry animation when the back button is added or removed. 8132 , 8133 8134 initial: mounted.current ? { 8135 opacity: 0, 8136 transform: hasBackButton ? 'translateX(15%)' : 'translateX(-15%)' 8137 } : false // Don't show entry animation when DocumentBar mounts. 8138 , 8139 animate: { 8140 opacity: 1, 8141 transform: 'translateX(0%)' 8142 }, 8143 transition: isReducedMotion ? { 8144 duration: 0 8145 } : undefined, 8146 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 8147 icon: templateIcon 8148 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 8149 size: "body", 8150 as: "h1", 8151 "aria-label": TYPE_LABELS[postType] ? 8152 // eslint-disable-next-line @wordpress/valid-sprintf 8153 (0,external_wp_i18n_namespaceObject.sprintf)(TYPE_LABELS[postType], title) : undefined, 8154 children: title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : (0,external_wp_i18n_namespaceObject.__)('No Title') 8155 })] 8156 }, hasBackButton), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8157 className: "editor-document-bar__shortcut", 8158 children: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8159 })] 8160 })] 8161 }); 8162 } 8163 8164 ;// CONCATENATED MODULE: external ["wp","richText"] 8165 const external_wp_richText_namespaceObject = window["wp"]["richText"]; 8166 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js 8167 /** 8168 * External dependencies 8169 */ 8170 8171 8172 8173 const TableOfContentsItem = ({ 8174 children, 8175 isValid, 8176 level, 8177 href, 8178 onSelect 8179 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 8180 className: dist_clsx('document-outline__item', `is-$level.toLowerCase()}`, { 8181 'is-invalid': !isValid 8182 }), 8183 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { 8184 href: href, 8185 className: "document-outline__button", 8186 onClick: onSelect, 8187 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8188 className: "document-outline__emdash", 8189 "aria-hidden": "true" 8190 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 8191 className: "document-outline__level", 8192 children: level 8193 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8194 className: "document-outline__item-content", 8195 children: children 8196 })] 8197 }) 8198 }); 8199 /* harmony default export */ const document_outline_item = (TableOfContentsItem); 8200 8201 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js 8202 /** 8203 * WordPress dependencies 8204 */ 8205 8206 8207 8208 8209 8210 8211 8212 /** 8213 * Internal dependencies 8214 */ 8215 8216 8217 8218 /** 8219 * Module constants 8220 */ 8221 8222 8223 const emptyHeadingContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 8224 children: (0,external_wp_i18n_namespaceObject.__)('(Empty heading)') 8225 }); 8226 const incorrectLevelContent = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 8227 children: (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)') 8228 }, "incorrect-message")]; 8229 const singleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 8230 children: (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)') 8231 }, "incorrect-message-h1")]; 8232 const multipleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 8233 children: (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)') 8234 }, "incorrect-message-multiple-h1")]; 8235 function EmptyOutlineIllustration() { 8236 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { 8237 width: "138", 8238 height: "148", 8239 viewBox: "0 0 138 148", 8240 fill: "none", 8241 xmlns: "http://www.w3.org/2000/svg", 8242 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 8243 width: "138", 8244 height: "148", 8245 rx: "4", 8246 fill: "#F0F6FC" 8247 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 8248 x1: "44", 8249 y1: "28", 8250 x2: "24", 8251 y2: "28", 8252 stroke: "#DDDDDD" 8253 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 8254 x: "48", 8255 y: "16", 8256 width: "27", 8257 height: "23", 8258 rx: "4", 8259 fill: "#DDDDDD" 8260 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 8261 d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z", 8262 fill: "black" 8263 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 8264 x1: "55", 8265 y1: "59", 8266 x2: "24", 8267 y2: "59", 8268 stroke: "#DDDDDD" 8269 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 8270 x: "59", 8271 y: "47", 8272 width: "29", 8273 height: "23", 8274 rx: "4", 8275 fill: "#DDDDDD" 8276 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 8277 d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z", 8278 fill: "black" 8279 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 8280 x1: "80", 8281 y1: "90", 8282 x2: "24", 8283 y2: "90", 8284 stroke: "#DDDDDD" 8285 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 8286 x: "84", 8287 y: "78", 8288 width: "30", 8289 height: "23", 8290 rx: "4", 8291 fill: "#F0B849" 8292 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 8293 d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z", 8294 fill: "black" 8295 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 8296 x1: "66", 8297 y1: "121", 8298 x2: "24", 8299 y2: "121", 8300 stroke: "#DDDDDD" 8301 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 8302 x: "70", 8303 y: "109", 8304 width: "29", 8305 height: "23", 8306 rx: "4", 8307 fill: "#DDDDDD" 8308 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 8309 d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z", 8310 fill: "black" 8311 })] 8312 }); 8313 } 8314 8315 /** 8316 * Returns an array of heading blocks enhanced with the following properties: 8317 * level - An integer with the heading level. 8318 * isEmpty - Flag indicating if the heading has no content. 8319 * 8320 * @param {?Array} blocks An array of blocks. 8321 * 8322 * @return {Array} An array of heading blocks enhanced with the properties described above. 8323 */ 8324 const computeOutlineHeadings = (blocks = []) => { 8325 return blocks.flatMap((block = {}) => { 8326 if (block.name === 'core/heading') { 8327 return { 8328 ...block, 8329 level: block.attributes.level, 8330 isEmpty: isEmptyHeading(block) 8331 }; 8332 } 8333 return computeOutlineHeadings(block.innerBlocks); 8334 }); 8335 }; 8336 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0; 8337 8338 /** 8339 * Renders a document outline component. 8340 * 8341 * @param {Object} props Props. 8342 * @param {Function} props.onSelect Function to be called when an outline item is selected. 8343 * @param {boolean} props.isTitleSupported Indicates whether the title is supported. 8344 * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled. 8345 * 8346 * @return {Component} The component to be rendered. 8347 */ 8348 function DocumentOutline({ 8349 onSelect, 8350 isTitleSupported, 8351 hasOutlineItemsDisabled 8352 }) { 8353 const { 8354 selectBlock 8355 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 8356 const { 8357 blocks, 8358 title 8359 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8360 var _postType$supports$ti; 8361 const { 8362 getBlocks 8363 } = select(external_wp_blockEditor_namespaceObject.store); 8364 const { 8365 getEditedPostAttribute 8366 } = select(store_store); 8367 const { 8368 getPostType 8369 } = select(external_wp_coreData_namespaceObject.store); 8370 const postType = getPostType(getEditedPostAttribute('type')); 8371 return { 8372 title: getEditedPostAttribute('title'), 8373 blocks: getBlocks(), 8374 isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false 8375 }; 8376 }); 8377 const headings = computeOutlineHeadings(blocks); 8378 if (headings.length < 1) { 8379 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 8380 className: "editor-document-outline has-no-headings", 8381 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 8382 children: (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.') 8383 })] 8384 }); 8385 } 8386 let prevHeadingLevel = 1; 8387 8388 // Not great but it's the simplest way to locate the title right now. 8389 const titleNode = document.querySelector('.editor-post-title__input'); 8390 const hasTitle = isTitleSupported && title && titleNode; 8391 const countByLevel = headings.reduce((acc, heading) => ({ 8392 ...acc, 8393 [heading.level]: (acc[heading.level] || 0) + 1 8394 }), {}); 8395 const hasMultipleH1 = countByLevel[1] > 1; 8396 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8397 className: "document-outline", 8398 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { 8399 children: [hasTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_outline_item, { 8400 level: (0,external_wp_i18n_namespaceObject.__)('Title'), 8401 isValid: true, 8402 onSelect: onSelect, 8403 href: `#$titleNode.id}`, 8404 isDisabled: hasOutlineItemsDisabled, 8405 children: title 8406 }), headings.map((item, index) => { 8407 // Headings remain the same, go up by one, or down by any amount. 8408 // Otherwise there are missing levels. 8409 const isIncorrectLevel = item.level > prevHeadingLevel + 1; 8410 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); 8411 prevHeadingLevel = item.level; 8412 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(document_outline_item, { 8413 level: `H$item.level}`, 8414 isValid: isValid, 8415 isDisabled: hasOutlineItemsDisabled, 8416 href: `#block-$item.clientId}`, 8417 onSelect: () => { 8418 selectBlock(item.clientId); 8419 onSelect?.(); 8420 }, 8421 children: [item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({ 8422 html: item.attributes.content 8423 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings] 8424 }, index); 8425 })] 8426 }) 8427 }); 8428 } 8429 8430 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js 8431 /** 8432 * WordPress dependencies 8433 */ 8434 8435 8436 8437 /** 8438 * Component check if there are any headings (core/heading blocks) present in the document. 8439 * 8440 * @param {Object} props Props. 8441 * @param {Element} props.children Children to be rendered. 8442 * 8443 * @return {Component|null} The component to be rendered or null if there are headings. 8444 */ 8445 function DocumentOutlineCheck({ 8446 children 8447 }) { 8448 const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)(select => { 8449 const { 8450 getGlobalBlockCount 8451 } = select(external_wp_blockEditor_namespaceObject.store); 8452 return getGlobalBlockCount('core/heading') > 0; 8453 }); 8454 if (hasHeadings) { 8455 return null; 8456 } 8457 return children; 8458 } 8459 8460 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js 8461 /** 8462 * WordPress dependencies 8463 */ 8464 8465 8466 8467 8468 8469 8470 8471 /** 8472 * Component for registering editor keyboard shortcuts. 8473 * 8474 * @return {Element} The component to be rendered. 8475 */ 8476 8477 function EditorKeyboardShortcutsRegister() { 8478 // Registering the shortcuts. 8479 const { 8480 registerShortcut 8481 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 8482 (0,external_wp_element_namespaceObject.useEffect)(() => { 8483 registerShortcut({ 8484 name: 'core/editor/toggle-mode', 8485 category: 'global', 8486 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), 8487 keyCombination: { 8488 modifier: 'secondary', 8489 character: 'm' 8490 } 8491 }); 8492 registerShortcut({ 8493 name: 'core/editor/save', 8494 category: 'global', 8495 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 8496 keyCombination: { 8497 modifier: 'primary', 8498 character: 's' 8499 } 8500 }); 8501 registerShortcut({ 8502 name: 'core/editor/undo', 8503 category: 'global', 8504 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), 8505 keyCombination: { 8506 modifier: 'primary', 8507 character: 'z' 8508 } 8509 }); 8510 registerShortcut({ 8511 name: 'core/editor/redo', 8512 category: 'global', 8513 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), 8514 keyCombination: { 8515 modifier: 'primaryShift', 8516 character: 'z' 8517 }, 8518 // Disable on Apple OS because it conflicts with the browser's 8519 // history shortcut. It's a fine alias for both Windows and Linux. 8520 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 8521 // Linux, we keep it as the default for consistency. 8522 aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ 8523 modifier: 'primary', 8524 character: 'y' 8525 }] 8526 }); 8527 registerShortcut({ 8528 name: 'core/editor/toggle-list-view', 8529 category: 'global', 8530 description: (0,external_wp_i18n_namespaceObject.__)('Open the List View.'), 8531 keyCombination: { 8532 modifier: 'access', 8533 character: 'o' 8534 } 8535 }); 8536 registerShortcut({ 8537 name: 'core/editor/toggle-distraction-free', 8538 category: 'global', 8539 description: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free mode.'), 8540 keyCombination: { 8541 modifier: 'primaryShift', 8542 character: '\\' 8543 } 8544 }); 8545 registerShortcut({ 8546 name: 'core/editor/toggle-sidebar', 8547 category: 'global', 8548 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'), 8549 keyCombination: { 8550 modifier: 'primaryShift', 8551 character: ',' 8552 } 8553 }); 8554 registerShortcut({ 8555 name: 'core/editor/keyboard-shortcuts', 8556 category: 'main', 8557 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), 8558 keyCombination: { 8559 modifier: 'access', 8560 character: 'h' 8561 } 8562 }); 8563 registerShortcut({ 8564 name: 'core/editor/next-region', 8565 category: 'global', 8566 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), 8567 keyCombination: { 8568 modifier: 'ctrl', 8569 character: '`' 8570 }, 8571 aliases: [{ 8572 modifier: 'access', 8573 character: 'n' 8574 }] 8575 }); 8576 registerShortcut({ 8577 name: 'core/editor/previous-region', 8578 category: 'global', 8579 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), 8580 keyCombination: { 8581 modifier: 'ctrlShift', 8582 character: '`' 8583 }, 8584 aliases: [{ 8585 modifier: 'access', 8586 character: 'p' 8587 }, { 8588 modifier: 'ctrlShift', 8589 character: '~' 8590 }] 8591 }); 8592 }, [registerShortcut]); 8593 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {}); 8594 } 8595 /* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister); 8596 8597 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js 8598 /** 8599 * WordPress dependencies 8600 */ 8601 8602 8603 const redo_redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8604 xmlns: "http://www.w3.org/2000/svg", 8605 viewBox: "0 0 24 24", 8606 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8607 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" 8608 }) 8609 }); 8610 /* harmony default export */ const library_redo = (redo_redo); 8611 8612 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js 8613 /** 8614 * WordPress dependencies 8615 */ 8616 8617 8618 const undo_undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8619 xmlns: "http://www.w3.org/2000/svg", 8620 viewBox: "0 0 24 24", 8621 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8622 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" 8623 }) 8624 }); 8625 /* harmony default export */ const library_undo = (undo_undo); 8626 8627 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js 8628 /** 8629 * WordPress dependencies 8630 */ 8631 8632 8633 8634 8635 8636 8637 8638 /** 8639 * Internal dependencies 8640 */ 8641 8642 8643 function EditorHistoryRedo(props, ref) { 8644 const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); 8645 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []); 8646 const { 8647 redo 8648 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 8649 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8650 ...props, 8651 ref: ref, 8652 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo 8653 /* translators: button label text should, if possible, be under 16 characters. */, 8654 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), 8655 shortcut: shortcut 8656 // If there are no redo levels we don't want to actually disable this 8657 // button, because it will remove focus for keyboard users. 8658 // See: https://github.com/WordPress/gutenberg/issues/3486 8659 , 8660 "aria-disabled": !hasRedo, 8661 onClick: hasRedo ? redo : undefined, 8662 className: "editor-history__redo" 8663 }); 8664 } 8665 8666 /** @typedef {import('react').Ref<HTMLElement>} Ref */ 8667 8668 /** 8669 * Renders the redo button for the editor history. 8670 * 8671 * @param {Object} props - Props. 8672 * @param {Ref} ref - Forwarded ref. 8673 * 8674 * @return {Component} The component to be rendered. 8675 */ 8676 /* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo)); 8677 8678 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js 8679 /** 8680 * WordPress dependencies 8681 */ 8682 8683 8684 8685 8686 8687 8688 8689 /** 8690 * Internal dependencies 8691 */ 8692 8693 8694 function EditorHistoryUndo(props, ref) { 8695 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []); 8696 const { 8697 undo 8698 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 8699 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8700 ...props, 8701 ref: ref, 8702 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo 8703 /* translators: button label text should, if possible, be under 16 characters. */, 8704 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 8705 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') 8706 // If there are no undo levels we don't want to actually disable this 8707 // button, because it will remove focus for keyboard users. 8708 // See: https://github.com/WordPress/gutenberg/issues/3486 8709 , 8710 "aria-disabled": !hasUndo, 8711 onClick: hasUndo ? undo : undefined, 8712 className: "editor-history__undo" 8713 }); 8714 } 8715 8716 /** @typedef {import('react').Ref<HTMLElement>} Ref */ 8717 8718 /** 8719 * Renders the undo button for the editor history. 8720 * 8721 * @param {Object} props - Props. 8722 * @param {Ref} ref - Forwarded ref. 8723 * 8724 * @return {Component} The component to be rendered. 8725 */ 8726 /* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo)); 8727 8728 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js 8729 /** 8730 * WordPress dependencies 8731 */ 8732 8733 8734 8735 8736 8737 8738 8739 8740 function TemplateValidationNotice() { 8741 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 8742 const isValid = (0,external_wp_data_namespaceObject.useSelect)(select => { 8743 return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate(); 8744 }, []); 8745 const { 8746 setTemplateValidity, 8747 synchronizeTemplate 8748 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 8749 if (isValid) { 8750 return null; 8751 } 8752 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8753 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 8754 className: "editor-template-validation-notice", 8755 isDismissible: false, 8756 status: "warning", 8757 actions: [{ 8758 label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'), 8759 onClick: () => setTemplateValidity(true) 8760 }, { 8761 label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'), 8762 onClick: () => setShowConfirmDialog(true) 8763 }], 8764 children: (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.') 8765 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 8766 isOpen: showConfirmDialog, 8767 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Reset'), 8768 onConfirm: () => { 8769 setShowConfirmDialog(false); 8770 synchronizeTemplate(); 8771 }, 8772 onCancel: () => setShowConfirmDialog(false), 8773 size: "medium", 8774 children: (0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?') 8775 })] 8776 }); 8777 } 8778 8779 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js 8780 /** 8781 * WordPress dependencies 8782 */ 8783 8784 8785 8786 8787 /** 8788 * Internal dependencies 8789 */ 8790 8791 8792 /** 8793 * This component renders the notices displayed in the editor. It displays pinned notices first, followed by dismissible 8794 * 8795 * @example 8796 * ```jsx 8797 * <EditorNotices /> 8798 * ``` 8799 * 8800 * @return {JSX.Element} The rendered EditorNotices component. 8801 */ 8802 8803 8804 8805 function EditorNotices() { 8806 const { 8807 notices 8808 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 8809 notices: select(external_wp_notices_namespaceObject.store).getNotices() 8810 }), []); 8811 const { 8812 removeNotice 8813 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 8814 const dismissibleNotices = notices.filter(({ 8815 isDismissible, 8816 type 8817 }) => isDismissible && type === 'default'); 8818 const nonDismissibleNotices = notices.filter(({ 8819 isDismissible, 8820 type 8821 }) => !isDismissible && type === 'default'); 8822 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8823 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { 8824 notices: nonDismissibleNotices, 8825 className: "components-editor-notices__pinned" 8826 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { 8827 notices: dismissibleNotices, 8828 className: "components-editor-notices__dismissible", 8829 onRemove: removeNotice, 8830 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {}) 8831 })] 8832 }); 8833 } 8834 /* harmony default export */